Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
repp_backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julieta Dubra Raimunde
repp_backend
Commits
4dc83e80
Commit
4dc83e80
authored
3 years ago
by
Agustin Ruiz Diaz Cambon
Browse files
Options
Downloads
Patches
Plain Diff
ValidationError message fix(should be refactored)
parent
e3a21426
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#15997
passed with stage
in 1 minute and 44 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/index.ts
+7
-1
7 additions, 1 deletion
src/index.ts
with
7 additions
and
1 deletion
src/index.ts
+
7
−
1
View file @
4dc83e80
...
...
@@ -44,7 +44,13 @@ app.use((error: Error, request: Request, response: Response, next: NextFunction)
// Check the error is a validation error
if
(
error
instanceof
ValidationError
)
{
// TODO: Handle error message accordingly
response
.
status
(
400
).
send
(
error
.
validationErrors
.
body
);
let
msg
:
string
|
undefined
;
if
(
error
.
validationErrors
.
body
&&
error
.
validationErrors
.
body
[
0
])
{
msg
=
error
.
validationErrors
.
body
[
0
].
message
;
}
if
(
msg
)
{
response
.
status
(
400
).
send
(
msg
);
}
next
();
}
else
{
// Pass error on if not a validation error
...
...
This diff is collapsed.
Click to expand it.
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