UNPKG

1.45 kBMarkdownView Raw
1[Grunt homepage](https://github.com/cowboy/grunt) | [Documentation table of contents](toc.md)
2
3# [The grunt API](api.md) / grunt.fail
4
5For when something goes horribly wrong.
6
7See the [fail lib source](../lib/grunt/fail.js) for more information.
8
9## The fail API
10
11If 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
13Note 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 ☃
16Display 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
19grunt.warn(error [, errorcode])
20```
21
22If `--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 ☃
27Display a warning and abort grunt immediately. The `error` argument can be a string message or an error object.
28
29```javascript
30grunt.fail(error [, errorcode])
31```
32
33If `--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)._