@colisweb/rescript-toolkit 2.38.3 → 2.39.0
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/package.json
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
open BsSentry
|
|
2
|
-
|
|
3
1
|
type t
|
|
4
2
|
@val external windowInstance: option<t> = "window"
|
|
5
3
|
@val external window: t = "window"
|
|
@@ -7,6 +5,8 @@ type t
|
|
|
7
5
|
let get = () => Js.typeof(windowInstance) !== "undefined" ? window : process
|
|
8
6
|
let instance = get()
|
|
9
7
|
|
|
8
|
+
@new
|
|
9
|
+
external makeError: string => Js.Exn.t = "Error"
|
|
10
10
|
@get external _nodeEnv: t => string = "NODE_ENV"
|
|
11
11
|
|
|
12
12
|
let nodeEnv = instance->_nodeEnv
|
|
@@ -50,14 +50,11 @@ let warning3 = (str, str2, str3) => {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
let error = str => {
|
|
53
|
+
let error = (str: string) => {
|
|
54
54
|
if nodeEnv !== "production" {
|
|
55
55
|
Js.Console.log3("%cERROR", errorStyle, str)
|
|
56
56
|
} else {
|
|
57
|
-
|
|
58
|
-
withScope(_scope => {
|
|
59
|
-
captureMessage(Obj.magic(str))
|
|
60
|
-
})
|
|
57
|
+
DatadogRum.Browser.addError(makeError(str))
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
60
|
|
|
@@ -65,10 +62,11 @@ let error2 = (str, str2) => {
|
|
|
65
62
|
if nodeEnv !== "production" {
|
|
66
63
|
Js.Console.log4("%cERROR", errorStyle, str, str2)
|
|
67
64
|
} else {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
DatadogRum.Browser.addErrorWithContext(
|
|
66
|
+
makeError(str),
|
|
67
|
+
{
|
|
68
|
+
"cause": str2,
|
|
69
|
+
},
|
|
70
|
+
)
|
|
73
71
|
}
|
|
74
72
|
}
|
|
@@ -19,4 +19,7 @@ module Browser = {
|
|
|
19
19
|
|
|
20
20
|
@module("@datadog/browser-rum") @scope("datadogRum")
|
|
21
21
|
external addError: Js.Exn.t => unit = "addError"
|
|
22
|
+
|
|
23
|
+
@module("@datadog/browser-rum") @scope("datadogRum")
|
|
24
|
+
external addErrorWithContext: (Js.Exn.t, 'context) => unit = "addError"
|
|
22
25
|
}
|