1.0.1-1 • Published 7 years ago

tp-framework-errors v1.0.1-1

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

tp-framework-errors

Travelplanet Framework component: Errors and logs management

Usage

const errors = require('@developpement/tp-framework-errors');
errors.InitLogger(app);
errors.LogError('This is an error message');
errors.LogDebug('This is a debug message displayed in Dev only');

// ... in a action such as GET /hello-world

try {
  // ...
} catch (err) {
  return errors.HaltRequest(res, 404, { code: 'ERR_NOT_FOUND', message: 'Cannot find this page' }, err);
}