Skip to content

Commit

Permalink
Moved HTTPException docs to errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkbushell committed Jan 19, 2013
1 parent e9a2227 commit a42aa5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 16 additions & 0 deletions errors.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Errors & Logging

- [Error Detail](#error-detail)
- [HTTP Exceptions](#http-exceptions)
- [Handling Errors](#handling-errors)
- [Handling 404 Errors](#handling-404-errors)
- [Logging](#logging)
Expand Down Expand Up @@ -34,6 +35,21 @@ If an exception handler returns a response, that response will be sent to the br
return 'Sorry! Something is wrong with this account!';
});

<a name="http-exceptions"></a>
## HTTP Exceptions
Exceptions in respect to HTTP, refer to errors that may occur during a client request. This may be a page
not found error (404), an authorized error (401) or even a generated 500 error. In order to return such a response, use the following:

App::abort(404, 'Page not found');

The first argument, is the HTTP status code, with the following being a custom message you'd like to show with the error.

In order to raise a 401 Unauthorized exception, just do the following:

App::abort(401, 'You are not authorized.');

These exceptions can be executed at any time during the request's lifecycle.

<a name="handling-404-errors"></a>
## Handling 404 Errors

Expand Down
16 changes: 0 additions & 16 deletions responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- [Redirects](#redirects)
- [Views](#views)
- [View Composers](#view-composers)
- [HTTP Exceptions](#http-exceptions)
- [Special Responses](#special-responses)

<a name="basic-responses"></a>
Expand Down Expand Up @@ -144,21 +143,6 @@ A view composer class should be defined like so:

Note that there is no convention on where composer classes may be stored. You are free to store them anywhere as long as they can be autoloaded using the directives in your `composer.json` file.

<a name="http-exceptions"></a>
## HTTP Exceptions
Exceptions in respect to HTTP, refer to errors that may occur during a client request. This may be a page
not found error (404), an authorized error (401) or even a generated 500 error. In order to return such a response, use the following:

App::abort(404, 'Page not found');

The first argument, is the HTTP status code, with the following being a custom message you'd like to show with the error.

In order to raise a 401 Unauthorized exception, just do the following:

App::abort(401, 'You are not authorized.');

These exceptions can be executed at any time during the request's lifecycle.

<a name="special-responses"></a>
## Special Responses

Expand Down

0 comments on commit a42aa5d

Please sign in to comment.