You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The definition of the word exceptionless is: to be without exception. Exceptionless.js provides real-time error reporting for your JavaScript applications in the browser or in Node.js. It organizes the gathered information into simple actionable data that will help your app become exceptionless!
8
+
The definition of the word exceptionless is: to be without exception. Exceptionless provides real-time error reporting for your JavaScript applications in the browser or in Node.js. It organizes the gathered information into simple actionable data that will help your app become exceptionless!
You can install the npm package via `npm install @exceptionless/node --save`.
45
+
Next, you just need to call startup during your apps startup to automatically
46
+
capture unhandled errors.
41
47
42
-
You can install Exceptionless.js either in your browser application using Bower or a `script` tag, or you can use the Node Package Manager (npm) to install the Node.js package.
- You can create a new instance of the `ExceptionlessClient` class and specify the `apiKey`, `serverUrl` or [configuration object](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/packages/core/src/configuration/IConfigurationSettings.ts):
98
-
99
-
```javascript
100
-
var client =newexceptionless.ExceptionlessClient("API_KEY_HERE");
101
-
// or with an api key and server url
102
-
var client =newexceptionless.ExceptionlessClient("API_KEY_HERE", "http://localhost:5000");
103
-
// or with a configuration object
104
-
var client =newexceptionless.ExceptionlessClient({
105
-
apiKey:"API_KEY_HERE",
106
-
serverUrl:"http://localhost:5000",
107
-
submissionBatchSize:100
107
+
awaitExceptionless.startup((c) => {
108
+
c.apiKey="API_KEY_HERE";
109
+
c.usePersistedQueueStorage=true;
108
110
});
109
111
```
110
112
111
113
#### Node.js
112
114
113
-
- You can set the `apiKey` on the default `ExceptionlessClient` instance:
114
-
115
-
```javascript
116
-
var client =require("exceptionless").ExceptionlessClient.default;
117
-
client.config.apiKey="API_KEY_HERE";
118
-
```
115
+
Use this method to install Exceptionless into your Node application:
119
116
120
-
- You can create a new instance of the `ExceptionlessClient` class and specify the `apiKey`, `serverUrl` or [configuration object](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/packages/core/src/configuration/IConfigurationSettings.ts):
117
+
1. Install the package by running `npm install @exceptionless/node --save`.
118
+
2. Import the Exceptionless module in your application:
var client =newexceptionless.ExceptionlessClient("API_KEY_HERE");
126
-
// or with an api key and server url
127
-
var client =newexceptionless.ExceptionlessClient("API_KEY_HERE", "http://localhost:5000");
128
-
// or with a configuration object
129
-
var client =newexceptionless.ExceptionlessClient({
130
-
apiKey:"API_KEY_HERE",
131
-
serverUrl:"http://localhost:5000",
132
-
submissionBatchSize:100
123
+
awaitExceptionless.startup((c) => {
124
+
c.apiKey="API_KEY_HERE";
125
+
c.usePersistedQueueStorage=true;
133
126
});
134
127
```
135
128
129
+
### Configuring the client
130
+
131
+
In order to use Exceptionless, the `apiKey` setting has to be configured first.
132
+
You can configure the `ExceptionlessClient` class by calling
133
+
`await Exceptionless.startup("API_KEY_HERE");`. If you want to configure
134
+
additional client settings you'll want to call the `startup` overload that takes
135
+
a callback as shown below:
136
+
137
+
```js
138
+
awaitExceptionless.startup((c) => {
139
+
c.apiKey="API_KEY_HERE";
140
+
c.usePersistedQueueStorage=true;
141
+
c.useReferenceIds();
142
+
});
143
+
```
144
+
145
+
Please see the [docs](https://exceptionless.com/docs/clients/javascript/) for
146
+
more information on configuring the client.
147
+
136
148
### Submitting Events and Errors
137
149
138
-
Once configured, Exceptionless.js will automatically submit any unhandled exceptions that happen in your application to the Exceptionless server. The following sections will show you how to manually submit different event types as well as customize the data that is sent:
150
+
Once configured, Exceptionless will automatically submit any unhandled exceptions
151
+
that happen in your application to the Exceptionless server. The following
152
+
sections will show you how to manually submit different event types as well as
153
+
customize the data that is sent:
139
154
140
155
#### Submitting Events
141
156
142
157
You may also want to submit log messages, feature usage data or other kinds of events. You can do this very easily with the fluent API:
143
158
144
-
```javascript
145
-
// Browser
146
-
var client =exceptionless.ExceptionlessClient.default;
147
-
// Node.js
148
-
// var client = require("exceptionless").ExceptionlessClient.default;
client.submitEvent({ message ="Low Fuel", type ="racecar", source ="Fuel System" });
178
+
awaitExceptionless.submitEvent({ message ="Low Fuel", type ="racecar", source ="Fuel System" });
167
179
```
168
180
169
181
#### Manually submitting Errors
170
182
171
-
In addition to automatically sending all unhandled exceptions, you may want to manually send exceptions to the service. You can do so by using code like this:
183
+
In addition to automatically sending all unhandled exceptions, you may want to
184
+
manually send exceptions to the service. You can do so by using code like this:
172
185
173
-
```javascript
174
-
// Browser
175
-
var client =exceptionless.ExceptionlessClient.default;
176
-
// Node.js
177
-
// var client = require("exceptionless").ExceptionlessClient.default;
You can easily include additional information in your error reports using the fluent [event builder API](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/packages/core/src/EventBuilder.ts).
189
200
190
-
```javascript
191
-
// Browser
192
-
var client =exceptionless.ExceptionlessClient.default;
193
-
// Node.js
194
-
// var client = require("exceptionless").ExceptionlessClient.default;
thrownewError("Unable to create order from quote.");
198
207
} catch (error) {
199
-
client.createException(error)
208
+
awaitExceptionless.createException(error)
200
209
// Set the reference id of the event so we can search for it later (reference:id).
201
-
// This will automatically be populated if you call client.config.useReferenceIds();
210
+
// This will automatically be populated if you call Exceptionless.config.useReferenceIds();
202
211
.setReferenceId("random guid")
203
212
// Add the order object (the ability to exclude specific fields will be coming in a future version).
204
213
.setProperty("Order", order)
@@ -219,23 +228,15 @@ try {
219
228
220
229
## Self hosted options
221
230
222
-
The Exceptionless client can also be configured to send data to your self hosted instance. This is configured by setting the `serverUrl` setting to point to your Exceptionless instance:
231
+
The Exceptionless client can also be configured to send data to your self hosted
232
+
instance. This is configured by setting the `serverUrl` on the default
233
+
`ExceptionlessClient` when calling `startup`:
223
234
224
-
#### Browser
225
-
226
-
You can set the `serverUrl` on the default `ExceptionlessClient` instance:
You can set the `serverUrl` on the default `ExceptionlessClient` instance:
235
-
236
-
```javascript
237
-
var client =require("exceptionless.node").ExceptionlessClient.default;
238
-
client.config.serverUrl="http://localhost:5000";
235
+
```js
236
+
awaitExceptionless.startup((c) => {
237
+
c.apiKey="API_KEY_HERE";
238
+
c.serverUrl="http://localhost:5000";
239
+
});
239
240
```
240
241
241
242
### General Data Protection Regulation
@@ -248,7 +249,10 @@ for detailed information on how to configure the client to meet your requirement
248
249
249
250
## Support
250
251
251
-
If you need help, please contact us via in-app support, [open an issue](https://github.com/exceptionless/Exceptionless.JavaScript/issues/new) or [join our chat on Discord](https://discord.gg/6HxgFCx). We’re always here to help if you have any questions!
252
+
If you need help, please contact us via in-app support,
253
+
[open an issue](https://github.com/exceptionless/Exceptionless.JavaScript/issues/new)
254
+
or [join our chat on Discord](https://discord.gg/6HxgFCx). We’re always here to
255
+
help if you have any questions!
252
256
253
257
## Contributing
254
258
@@ -261,7 +265,7 @@ If you find a bug or want to contribute a feature, feel free to create a pull re
261
265
```
262
266
263
267
2. Install [Node.js](https://nodejs.org). Node is used for building and testing purposes.
264
-
3. Install [gulp](http://gulpjs.com) and the development dependencies using [npm](https://www.npmjs.com).
268
+
3. Install the development dependencies using [npm](https://www.npmjs.com).
265
269
266
270
```sh
267
271
npm install
@@ -279,8 +283,6 @@ If you find a bug or want to contribute a feature, feel free to create a pull re
279
283
npm run test
280
284
```
281
285
282
-
During development, you can use relative paths to require Exceptionless, e.g. `require("./dist/exceptionless.node.js")` when you are running Node.js from the git root directory.
0 commit comments