donejs-error-format
An error formatter for Errors that are emitted by done-ssr.

Install
npm install donejs-error-format --save
Usage
If you are using done-serve, it already uses donejs-error-format internally. If you use done-ssr or done-ssr-middleware, you can use this module to format your error messages.
done-ssr
const errorFormat = ;const ssr = ; const render = ; { // More stuff here, obviously, like static assets, etc. let stream = ; stream; stream;} ;
done-ssr-middleware
const express = ;const errorFormat = ;const ssr = ; const app = ; app; app; // The last middleware should be the error handlerapp;
API
.extract(error)
This function takes an Error and returns an object with parts extracted. This is used to pass into .html()
and other formatting functions (currently there is only HTML).
.html(parts)
This function is used to generate formatted HTML. It takes a parts object that comes from using .extract
.
let parts = errorFormat;let html = errorFormat;
.html(parts, options)
The second signature is like the first but takes an options object. The options are:
- liveReload: This can either be the boolean
true
or an object that provides the port like:{ port: 4044 }
. By default the port 8012 is used (which is the default in DoneJS apps). You only need to set this option if you are using an alternative port in your development server.
Enabling the live-reload script:
let parts = errorFormat;let html = errorFormat
Or with a port:
let parts = errorFormat;let html = errorFormat
License
MIT