1 | [Grunt homepage](https://github.com/cowboy/grunt) | [Documentation table of contents](toc.md)
|
2 |
|
3 | # [The grunt API](api.md) / grunt.fail
|
4 |
|
5 | For when something goes horribly wrong.
|
6 |
|
7 | See the [fail lib source](../lib/grunt/fail.js) for more information.
|
8 |
|
9 | ## The fail API
|
10 |
|
11 | If something explodes (or is about to explode) inside a helper or task, it can force grunt to abort. See the [exit codes documentation](exit_codes.md) for a list of all built-in grunt exit codes.
|
12 |
|
13 | Note that any method marked with a ☃ (unicode snowman) is also available directly on the `grunt` object. Just so you know. See the [API main page](api.md) for more usage information.
|
14 |
|
15 | ### grunt.warn ☃
|
16 | Display a warning and abort grunt immediately. Grunt will continue processing tasks if the `--force` command-line option was specified. The `error` argument can be a string message or an error object.
|
17 |
|
18 | ```javascript
|
19 | grunt.warn(error [, errorcode])
|
20 | ```
|
21 |
|
22 | If `--debug 9` is specified on the command-line and an error object was specified, a stack trace will be logged.
|
23 |
|
24 | _This method is also available as [grunt.warn](api.md)._
|
25 |
|
26 | ### grunt.fatal ☃
|
27 | Display a warning and abort grunt immediately. The `error` argument can be a string message or an error object.
|
28 |
|
29 | ```javascript
|
30 | grunt.fail(error [, errorcode])
|
31 | ```
|
32 |
|
33 | If `--debug 9` is specified on the command-line and an error object was specified, a stack trace will be logged.
|
34 |
|
35 | _This method is also available as [grunt.fatal](api.md)._
|