Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
egl_konnector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
egl_konnector
Commits
3285ec7e
Commit
3285ec7e
authored
1 year ago
by
Bastien Dumont
Browse files
Options
Downloads
Patches
Plain Diff
vendor down
parent
b1500174
No related branches found
No related tags found
1 merge request
!28
fix: throw vendor down on auth
Pipeline
#74033
passed
1 year ago
Stage: test
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/index.js
+8
-6
8 additions, 6 deletions
src/index.js
with
8 additions
and
6 deletions
src/index.js
+
8
−
6
View file @
3285ec7e
...
...
@@ -202,6 +202,7 @@ async function buildAggregatedData(data, doctype) {
}
async
function
authenticate
(
login
,
password
,
baseUrl
,
apiAuthKey
)
{
log
(
'
info
'
,
'
Authenticating ...
'
)
const
authRequest
=
{
method
:
'
post
'
,
url
:
baseUrl
+
'
/connect.aspx
'
,
...
...
@@ -219,13 +220,14 @@ async function authenticate(login, password, baseUrl, apiAuthKey) {
const
resp
=
await
axios
(
authRequest
)
if
(
resp
.
data
.
codeRetour
===
100
)
{
return
resp
.
data
}
else
{
const
errorMessage
=
`Authentication failed. Response data:
${
resp
.
data
.
libelleRetour
}
`
log
(
'
debug
'
,
errorMessage
)
throw
new
Error
(
`code retour ko :
${
resp
.
data
.
codeRetour
}
`
)
}
else
if
(
resp
.
data
.
codeRetour
===
-
4
)
{
throw
new
Error
(
errors
.
LOGIN_FAILED
)
}
const
errorMessage
=
`Authentication failed. Response data:
${
resp
?.
data
?.
libelleRetour
}
`
log
(
'
error
'
,
errorMessage
)
throw
new
Error
(
errors
.
VENDOR_DOWN
)
}
catch
(
error
)
{
log
(
'
debug
'
,
error
.
m
es
sage
)
log
(
'
error
'
,
error
.
r
es
ponse
?.
data
)
Sentry
.
captureException
(
error
,
{
tags
:
{
section
:
'
authenticate
'
,
...
...
@@ -234,7 +236,7 @@ async function authenticate(login, password, baseUrl, apiAuthKey) {
compte
:
login
,
},
})
throw
new
Error
(
errors
.
LOGIN_FAILED
)
throw
error
}
}
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in commit
f4726ca9
·
1 year ago
mentioned in commit
f4726ca9
mentioned in commit f4726ca9ae424cf1903bbc600db561e6345d0e5b
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment