-
Notifications
You must be signed in to change notification settings - Fork 0
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: meanjs/mean#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
welcome-dev
committed
Oct 8, 2016
1 parent
9f61d78
commit 1054be2
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