- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
78 lines
1.6 KiB
Markdown
78 lines
1.6 KiB
Markdown
makeerror [](http://travis-ci.org/nshah/nodejs-makeerror)
|
|
=========
|
|
|
|
A library to make errors.
|
|
|
|
|
|
Basics
|
|
------
|
|
|
|
Makes an Error constructor function with the signature below. All arguments are
|
|
optional, and if the first argument is not a `String`, it will be assumed to be
|
|
`data`:
|
|
|
|
```javascript
|
|
function(message, data)
|
|
```
|
|
|
|
You'll typically do something like:
|
|
|
|
```javascript
|
|
var makeError = require('makeerror')
|
|
var UnknownFileTypeError = makeError(
|
|
'UnknownFileTypeError',
|
|
'The specified type is not known.'
|
|
)
|
|
var er = UnknownFileTypeError()
|
|
```
|
|
|
|
`er` will have a prototype chain that ensures:
|
|
|
|
```javascript
|
|
er instanceof UnknownFileTypeError
|
|
er instanceof Error
|
|
```
|
|
|
|
|
|
Templatized Error Messages
|
|
--------------------------
|
|
|
|
There is support for simple string substitutions like:
|
|
|
|
```javascript
|
|
var makeError = require('makeerror')
|
|
var UnknownFileTypeError = makeError(
|
|
'UnknownFileTypeError',
|
|
'The specified type "{type}" is not known.'
|
|
)
|
|
var er = UnknownFileTypeError({ type: 'bmp' })
|
|
```
|
|
|
|
Now `er.message` or `er.toString()` will return `'The specified type "bmp" is
|
|
not known.'`.
|
|
|
|
|
|
Prototype Hierarchies
|
|
---------------------
|
|
|
|
You can create simple hierarchies as well using the `prototype` chain:
|
|
|
|
```javascript
|
|
var makeError = require('makeerror')
|
|
var ParentError = makeError('ParentError')
|
|
var ChildError = makeError(
|
|
'ChildError',
|
|
'The child error.',
|
|
{ proto: ParentError() }
|
|
)
|
|
var er = ChildError()
|
|
```
|
|
|
|
`er` will have a prototype chain that ensures:
|
|
|
|
```javascript
|
|
er instanceof ChildError
|
|
er instanceof ParentError
|
|
er instanceof Error
|
|
```
|