@atsail/browser 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,8 +142,10 @@ function init(options) {
|
|
|
142
142
|
installXhrInterceptor(emit);
|
|
143
143
|
}
|
|
144
144
|
function captureException(error, context) {
|
|
145
|
-
if (!transport)
|
|
145
|
+
if (!transport) {
|
|
146
|
+
console.warn("[atsail] captureException called before init() — event dropped");
|
|
146
147
|
return;
|
|
148
|
+
}
|
|
147
149
|
transport.enqueue({
|
|
148
150
|
type: "exception",
|
|
149
151
|
message: error instanceof Error ? error.message : String(error),
|
|
@@ -153,8 +155,10 @@ function captureException(error, context) {
|
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
function captureMessage(message, level = "info", context) {
|
|
156
|
-
if (!transport)
|
|
158
|
+
if (!transport) {
|
|
159
|
+
console.warn("[atsail] captureMessage called before init() — event dropped");
|
|
157
160
|
return;
|
|
161
|
+
}
|
|
158
162
|
transport.enqueue({
|
|
159
163
|
type: "message",
|
|
160
164
|
message,
|
|
@@ -164,7 +168,11 @@ function captureMessage(message, level = "info", context) {
|
|
|
164
168
|
});
|
|
165
169
|
}
|
|
166
170
|
function flush() {
|
|
167
|
-
transport
|
|
171
|
+
if (!transport) {
|
|
172
|
+
console.warn("[atsail] flush called before init() — nothing to send");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
transport.flush();
|
|
168
176
|
}
|
|
169
177
|
export {
|
|
170
178
|
init,
|