- 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
61 lines
2.0 KiB
Markdown
61 lines
2.0 KiB
Markdown
Nested stacktraces for Node.js!
|
|
===============================
|
|
|
|
[](https://travis-ci.org/mdlavin/nested-error-stacks)
|
|
[](http://badge.fury.io/js/nested-error-stacks)
|
|
[](https://david-dm.org/mdlavin/nested-error-stacks)
|
|
|
|
With this module, you can wrap a caught exception with extra context
|
|
for better debugging. For example, a network error's stack would normally look
|
|
like this:
|
|
|
|
Error: connect ECONNREFUSED
|
|
at errnoException (net.js:904:11)
|
|
at Object.afterConnect [as oncomplete] (net.js:895:19)
|
|
|
|
Using this module, you can wrap the Error with more context to get a stack
|
|
that looks like this:
|
|
|
|
NestedError: Failed to communicate with localhost:8080
|
|
at Socket.<anonymous> (/Users/mattlavin/Projects/nested-stacks/demo.js:6:18)
|
|
at Socket.EventEmitter.emit (events.js:95:17)
|
|
at net.js:440:14
|
|
at process._tickCallback (node.js:415:13)
|
|
Caused By: Error: connect ECONNREFUSED
|
|
at errnoException (net.js:904:11)
|
|
at Object.afterConnect [as oncomplete] (net.js:895:19)
|
|
|
|
How to wrap errors
|
|
------------------
|
|
|
|
Here is an example program that uses this module to add more context to errors:
|
|
|
|
```js
|
|
var NestedError = require('nested-error-stacks');
|
|
var net = require('net');
|
|
|
|
var client = net.connect({port: 8080});
|
|
client.on('error', function (err) {
|
|
var newErr = new NestedError("Failed to communicate with localhost:8080", err);
|
|
console.log(newErr.stack);
|
|
});
|
|
```
|
|
|
|
How to inherit
|
|
--------------
|
|
|
|
It is recommended to use explicit names for Error classes. You can do it
|
|
like this:
|
|
|
|
```js
|
|
var util = require('util');
|
|
var NestedError = require('nested-error-stacks');
|
|
|
|
function MyError(message, nested) {
|
|
NestedError.call(this, message, nested);
|
|
}
|
|
|
|
util.inherits(MyError, NestedError);
|
|
MyError.prototype.name = 'MyError';
|
|
```
|