@jetthai/cuora 1.1.443-dev.1 → 1.1.443-dev.2
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/request/request.js +1 -3
- package/src/util/err998SentryExtra.js +5 -31
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.443-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.443-dev.1...v1.1.443-dev.2) (2026-06-22)
|
|
6
|
+
|
|
5
7
|
### [1.1.443-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.443-dev.0...v1.1.443-dev.1) (2026-06-22)
|
|
6
8
|
|
|
7
9
|
### [1.1.443-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.443...v1.1.443-dev.0) (2026-06-18)
|
package/package.json
CHANGED
package/src/request/request.js
CHANGED
|
@@ -222,12 +222,10 @@ export default class Request {
|
|
|
222
222
|
(error) => {
|
|
223
223
|
if (error.message === 'Network Error' || error.message === 'Request failed with status code 404') {
|
|
224
224
|
const endpoint = error.config?.url || ''
|
|
225
|
-
const method = error.config?.method || ''
|
|
226
|
-
const baseURL = error.config?.baseURL || ''
|
|
227
225
|
// 確實在線才以 warning 等級回報(連線不穩定多為使用者端網路問題,非應用程式錯誤)
|
|
228
226
|
const isOnline = typeof navigator !== 'undefined' ? navigator.onLine : true
|
|
229
227
|
if (isOnline) {
|
|
230
|
-
const errData998 = getErr998SentryExtra(this,
|
|
228
|
+
const errData998 = getErr998SentryExtra(this, error.config)
|
|
231
229
|
const sentryError = new Error(`ERR_998:${error.message}`)
|
|
232
230
|
sentryError.name = 'ERR_998'
|
|
233
231
|
this.sentry?.captureException(sentryError, {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
// ERR_998(Network Error / 404)Sentry 回報資料組裝工具
|
|
2
2
|
// 集中組裝 tags/extra,避免在 request.js 內重複拼裝邏輯
|
|
3
|
-
export function getErr998SentryExtra(request,
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const endpoint = buildFullUrl(baseURL, relativePath)
|
|
8
|
-
const apiHost = getUrlOrigin(baseURL) || getUrlOrigin(relativePath) || request?.config?.apiURL || ''
|
|
3
|
+
export function getErr998SentryExtra(request, config) {
|
|
4
|
+
const method = config?.method || ''
|
|
5
|
+
const endpoint = config?.url || ''
|
|
6
|
+
const apiHost = request?.config?.apiURL || ''
|
|
9
7
|
const uidSite = getUidSite()
|
|
10
8
|
|
|
11
9
|
return {
|
|
12
10
|
code: 'ERR_998',
|
|
13
|
-
endpoint
|
|
11
|
+
endpoint,
|
|
14
12
|
method,
|
|
15
13
|
site: request?.config?.clientId || '',
|
|
16
14
|
ip: request?.clientIp || '',
|
|
@@ -19,25 +17,6 @@ export function getErr998SentryExtra(request, requestInfo) {
|
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
function buildFullUrl(baseURL, path) {
|
|
23
|
-
if (!path) return baseURL || ''
|
|
24
|
-
if (!baseURL) return path
|
|
25
|
-
try {
|
|
26
|
-
const base = baseURL.endsWith('/') ? baseURL : baseURL + '/'
|
|
27
|
-
return new URL(path, base).href
|
|
28
|
-
} catch {
|
|
29
|
-
return path
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getUrlOrigin(url) {
|
|
34
|
-
try {
|
|
35
|
-
return new URL(url).origin
|
|
36
|
-
} catch (error) {
|
|
37
|
-
return ''
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
20
|
function getUidSite() {
|
|
42
21
|
try {
|
|
43
22
|
return (typeof window !== 'undefined' && window.$nuxt?.$store?.state?.userInfo?.uid_site) || ''
|
|
@@ -45,8 +24,3 @@ function getUidSite() {
|
|
|
45
24
|
return ''
|
|
46
25
|
}
|
|
47
26
|
}
|
|
48
|
-
|
|
49
|
-
function normalizeSentryTagValue(value) {
|
|
50
|
-
if (value === undefined || value === null) return ''
|
|
51
|
-
return String(value).slice(0, 200)
|
|
52
|
-
}
|