Skip to content

Commit eb4695a

Browse files
authored
ref: Warn user when using capture/wrap without installing Raven (#402)
1 parent 228c609 commit eb4695a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/client.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ extend(Raven.prototype, {
4949

5050
this.raw_dsn = dsn;
5151
this.dsn = utils.parseDSN(dsn);
52-
this.name = options.name || global.process.env.SENTRY_NAME || require('os').hostname();
52+
this.name =
53+
options.name || global.process.env.SENTRY_NAME || require('os').hostname();
5354
this.root = options.root || global.process.cwd();
5455
this.transport = options.transport || transports[this.dsn.protocol];
5556
this.sendTimeout = options.sendTimeout || 1;
5657
this.release = options.release || global.process.env.SENTRY_RELEASE || '';
5758
this.environment =
58-
options.environment || global.process.env.SENTRY_ENVIRONMENT || global.process.env.NODE_ENV || '';
59+
options.environment ||
60+
global.process.env.SENTRY_ENVIRONMENT ||
61+
global.process.env.NODE_ENV ||
62+
'';
5963

6064
// autoBreadcrumbs: true enables all, autoBreadcrumbs: false disables all
6165
// autoBreadcrumbs: { http: true } enables a single type
@@ -385,6 +389,11 @@ extend(Raven.prototype, {
385389
},
386390

387391
wrap: function(options, func) {
392+
if (!this.installed) {
393+
utils.consoleAlertOnce(
394+
'Raven has not been installed, therefore no breadcrumbs will be captured. Call `Raven.config(...).install()` to fix this.'
395+
);
396+
}
388397
if (!func && typeof options === 'function') {
389398
func = options;
390399
options = {};

0 commit comments

Comments
 (0)