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!
9
6
10
-
Please follow the instructions below for installing the exceptionless JavaScript client.
11
-
12
-
#### JavaScript
13
-
Use one of the below methods to install exceptionless into your web app.
14
-
##### Bower
15
-
1. Install the package by running `bower install exceptionless` or skip this step and use the scripts hosted on our CDN.
16
-
2. Add the script to your html page. We recommend placing this as the very first script.
var client =exceptionless.ExceptionlessClient.default;
13
+
client.config.apiKey='API_KEY_HERE';
14
+
15
+
try {
16
+
thrownewError('test');
17
+
} catch (error) {
18
+
client.submitException(error);
19
+
}
20
+
</script>
25
21
```
26
22
27
-
#### Node.js
28
-
Use this method to install exceptionless into your node app.
29
-
1. Install the package by running `npm install exceptionless --save-dev`.
30
-
2. Add the exceptionless client to your app:
31
23
```javascript
32
-
var client =require('exceptionless.node').ExceptionlessClient.default;
24
+
var client =require('exceptionless').ExceptionlessClient.default;
25
+
client.config.apiKey='API_KEY_HERE';
26
+
27
+
try {
28
+
thrownewError('test');
29
+
} catch (error) {
30
+
client.submitException(error);
31
+
}
32
+
33
33
```
34
34
35
-
### Configuring the client.
36
-
You can configure the exceptionless client a few different ways. The section below will cover the different ways you can configure the ExceptionlessClient. _NOTE: The only required setting that you need to configure is the clients `apiKey`._
35
+
## Using Exceptionless
36
+
37
+
### Installation
38
+
39
+
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.
40
+
41
+
#### Browser application
42
+
Use one of the following methods to install Exceptionless.js into your browser application:
37
43
38
-
#### JavaScript
39
-
1. You can configure the `apiKey` as part of the script tag. This will be applied to all new instances of the ExceptionlessClient
var client = require('exceptionless').ExceptionlessClient.default;
71
+
```
72
+
73
+
### Configuring the client
74
+
In order to use Exceptionless.js, the `apiKey` setting has to be configured first.
75
+
You can configure the `ExceptionlessClient` class using one of the following ways:
76
+
77
+
#### Browser application
78
+
- You can configure the `apiKey` as part of the script tag. This will be applied to all new instances of the `ExceptionlessClient` class:
50
79
51
-
3. You can create a new instance of the ExceptionlessClient and specify the `apiKey`, `serverUrl` or [configuration object](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/src/configuration/IConfigurationSettings.ts).
- 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/src/configuration/IConfigurationSettings.ts):
91
+
92
+
```javascript
93
+
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE');
94
+
// or with an api key and server url
95
+
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE', 'http://localhost:50000');
96
+
// or with a configuration object
97
+
var client =newexceptionless.ExceptionlessClient({
98
+
apiKey:'API_KEY_HERE',
99
+
serverUrl:'http://localhost:50000',
100
+
submissionBatchSize:100
101
+
});
102
+
```
64
103
65
104
#### Node.js
66
-
1. You can set the `apiKey` on the default ExceptionlessClient instance.
105
+
- You can set the `apiKey` on the default `ExceptionlessClient` instance:
67
106
68
107
```javascript
69
-
var client =require('exceptionless.node').ExceptionlessClient.default;
70
-
client.config.apiKey='API_KEY_HERE';
71
-
```
108
+
var client =require('exceptionless').ExceptionlessClient.default;
109
+
client.config.apiKey='API_KEY_HERE';
110
+
```
72
111
73
-
2. You can create a new instance of the ExceptionlessClientand specify the `apiKey`, `serverUrl` or [configuration object](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/src/configuration/IConfigurationSettings.ts).
112
+
- 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/src/configuration/IConfigurationSettings.ts):
74
113
75
114
```javascript
76
-
var exceptionless =require('exceptionless.node');
77
-
78
-
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE');
79
-
// or with a api key and server url.
80
-
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE', 'http://localhost:50000');
81
-
// or with a configuration object
82
-
var client =newexceptionless.ExceptionlessClient({
83
-
apiKey:'API_KEY_HERE',
84
-
serverUrl:'http://localhost:50000',
85
-
submissionBatchSize:100
86
-
});
87
-
```
115
+
var exceptionless =require('exceptionless');
88
116
89
-
### Sending Events
90
-
Once configured, Exceptionless will automatically send any unhandled exceptions that happen in your application. The sections below will show you how to send us different event types as well as customize the data that is sent in.
117
+
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE');
118
+
// or with an api key and server url
119
+
var client =newexceptionless.ExceptionlessClient('API_KEY_HERE', 'http://localhost:50000');
120
+
// or with a configuration object
121
+
var client =newexceptionless.ExceptionlessClient({
122
+
apiKey:'API_KEY_HERE',
123
+
serverUrl:'http://localhost:50000',
124
+
submissionBatchSize:100
125
+
});
126
+
```
91
127
92
-
####Sending Events
128
+
### Submitting Events and Errors
129
+
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:
93
130
94
-
You may also want to send us log messages, feature usages or other kinds of events. You can do this very easily with our fluent api.
131
+
####Submitting Events
132
+
133
+
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:
95
134
96
135
```javascript
97
-
//javascript
136
+
//Browser
98
137
var client =exceptionless.ExceptionlessClient.default;
99
-
// Node.Js
100
-
// var client = require('exceptionless.node').ExceptionlessClient.default;
138
+
// Node.js
139
+
// var client = require('exceptionless').ExceptionlessClient.default;
client.submitEvent({ message ='Low Fuel', type ='racecar', source ='Fuel System' });
119
158
```
120
-
####Manually Sending Errors
159
+
####Manually submitting Errors
121
160
122
161
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:
123
162
124
163
```javascript
125
-
//javascript
164
+
//Browser
126
165
var client =exceptionless.ExceptionlessClient.default;
127
-
// Node.Js
128
-
// var client = require('exceptionless.node').ExceptionlessClient.default;
166
+
// Node.js
167
+
// var client = require('exceptionless').ExceptionlessClient.default;
129
168
130
169
try {
131
170
thrownewError('test');
@@ -136,12 +175,13 @@ try {
136
175
137
176
####Sending Additional Information
138
177
139
-
You can easily include additional information in your error reports using our fluent [event builder API](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/src/EventBuilder.ts).
178
+
You can easily include additional information in your error reports using the fluent [event builder API](https://github.com/exceptionless/Exceptionless.JavaScript/blob/master/src/EventBuilder.ts).
179
+
140
180
```javascript
141
-
//javascript
181
+
//Browser
142
182
var client =exceptionless.ExceptionlessClient.default;
143
-
// Node.Js
144
-
// var client = require('exceptionless.node').ExceptionlessClient.default;
183
+
// Node.js
184
+
// var client = require('exceptionless').ExceptionlessClient.default;
145
185
146
186
try {
147
187
thrownewError('Unable to create order from quote.');
@@ -169,40 +209,57 @@ try {
169
209
170
210
## Self hosted options
171
211
172
-
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.
212
+
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:
213
+
214
+
#### Browser
215
+
You can set the `serverUrl` on the default `ExceptionlessClient` instance:
173
216
174
-
#### JavaScript
175
-
You can set the `serverUrl` on the default ExceptionlessClient instance.
You can set the `serverUrl` on the default ExceptionlessClient instance.
222
+
You can set the `serverUrl` on the default `ExceptionlessClient` instance:
223
+
182
224
```javascript
183
225
var client =require('exceptionless.node').ExceptionlessClient.default;
184
226
client.config.serverUrl='http://localhost:50000';
185
227
```
186
228
187
-
## Getting Started (Development)
229
+
## Support
230
+
231
+
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 gitter](https://gitter.im/exceptionless/Discuss). We’re always here to help if you have any questions!
188
232
189
-
The JavaScript client can be installed via [bower](http://bower.io/search/?q=exceptionless), [npm](https://www.npmjs.com/package/exceptionless) or CDN. If you need help, please contact us via in-app support or [open an issue](https://github.com/exceptionless/Exceptionless.JavaScript/issues/new). We’re always here to help if you have any questions!
233
+
## Contributing
190
234
191
-
**This section is for development purposes only! If you are trying to use the Exceptionless JavaScript libraries, please get them from bower, npm or the CDN.**
235
+
If you find a bug or want to contribute a feature, feel free to create a pull request.
2. Install [Node.js](https://nodejs.org). Node is used for building and testing purposes.
192
244
193
-
1. You will need to clone this repo.
194
-
2. Install [Node.js](https://nodejs.org). _We only use node for our build and test processes._
195
245
3. Install [tsd](https://github.com/DefinitelyTyped/tsd) and [gulp](http://gulpjs.com) and the development dependencies using [npm](https://www.npmjs.com).
196
-
```javascript
197
-
npm install -g tsd
198
-
npm install -g gulp
199
-
npm install
200
-
```
246
+
247
+
```sh
248
+
npm install -g tsd
249
+
npm install -g gulp
250
+
npm install
251
+
```
252
+
201
253
4. Build the project by running the following gulp command.
202
-
```javascript
203
-
gulp build
204
-
```
254
+
255
+
```sh
256
+
gulp build
257
+
```
258
+
205
259
5. Test the project by running the following gulp command.
206
-
```javascript
207
-
gulp test
208
-
```
260
+
261
+
```sh
262
+
gulp test
263
+
```
264
+
265
+
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