This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Add custom 400 and 404 error messages (#1547)
* Added 400 and 404 custom error messages * nicer error message views * Sign Up & Sign In error responses Changed the error responses returned from the Sign Up & Sign In API calls to use 422 rather than 400. For insight into why this change was made: #1510 (comment) For reference on why to use 422 over 400: https://www.bennadel.com/blog/2434-http-status-codes-for-invalid-data-400-vs-422.htm
- Loading branch information
Showing
7 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
modules/core/client/controllers/error.client.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(function () { | ||
'use strict'; | ||
|
||
angular | ||
.module('core') | ||
.controller('ErrorController', ErrorController); | ||
|
||
ErrorController.$inject = ['$stateParams']; | ||
|
||
function ErrorController($stateParams) { | ||
var vm = this; | ||
vm.errorMessage = null; | ||
|
||
// Display custom message if it was set | ||
if ($stateParams.message) vm.errorMessage = $stateParams.message; | ||
} | ||
}()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
<h1>Bad Request</h1> | ||
<div class="page-header"> | ||
<h1>Bad Request</h1> | ||
</div> | ||
<div class="alert alert-danger" role="alert"> | ||
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> | ||
<span class="sr-only">Error:</span> | ||
You made a bad request | ||
<span ng-if="vm.errorMessage" ng-bind="vm.errorMessage"></span> | ||
<span ng-if="!vm.errorMessage">You made a bad request</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<h1>Page Not Found</h1> | ||
<div class="page-header"> | ||
<h1>Page Not Found</h1> | ||
</div> | ||
<div class="alert alert-danger" role="alert"> | ||
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> | ||
<span class="sr-only">Error:</span> Page Not Found | ||
<span ng-if="vm.errorMessage" ng-bind="vm.errorMessage"></span> | ||
<span ng-if="!vm.errorMessage">Page Not Found</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6be12f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this one is ready? I don't have time to check right now, but I recall that there were lots of 400 errors fired by the app for other purposes, that we don't necessarily want to redirect.
6be12f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hyperreality I'll look into it. Thanks.