jshttp/http-errors — pull request #10 by pluma (2014-10-28 23:06:11+00:00)
Title: Use Error.name for more meaningful stacktraces

This change is backwards-incompatible.

Currently all stack traces just call the error `Error`. It's more useful if the `Error.name` property is overridden with the actual name of the error instead.

Compare:

```
Error: Unknown filename "lol.jpg"
at ...
```

versus:

```
Not Found: Unknown filename "lol.jpg"
at ...
```

This change does exactly that.

Instead of using the name additionally as message, the errors now have an empty message by default (just like `Error`, `SyntaxError` etc). For example:

Before:

```
Error: Not Found
at ...
```

Now:

```
Not Found
at ...
```

(note no trailing colon -- just like the built-in errors).

This makes the change backwards incompatible, but I think this makes the behaviour more consistent with other error types and is worth it. `Error.message` wasn't meant to be used to identify errors anyway (that's what the numerical codes are for).