Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
989696f2
Commit
989696f2
authored
Sep 06, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
capture some exceptions manually
parent
701a12b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
getUrlWithNetwork.ts
lib/api/getUrlWithNetwork.ts
+2
-2
fetch.ts
lib/client/fetch.ts
+11
-4
No files found.
lib/api/getUrlWithNetwork.ts
View file @
989696f2
import
*
as
Sentry
from
'
@sentry/nextjs
'
;
import
type
{
NextApiRequest
}
from
'
next
'
;
import
type
{
NextApiRequest
}
from
'
next
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
...
@@ -7,8 +8,7 @@ export default function getUrlWithNetwork(_req: NextApiRequest, path: string) {
...
@@ -7,8 +8,7 @@ export default function getUrlWithNetwork(_req: NextApiRequest, path: string) {
const
networkSubType
=
_req
.
cookies
[
cookies
.
NAMES
.
NETWORK_SUB_TYPE
];
const
networkSubType
=
_req
.
cookies
[
cookies
.
NAMES
.
NETWORK_SUB_TYPE
];
if
(
!
networkType
||
!
networkSubType
)
{
if
(
!
networkType
||
!
networkSubType
)
{
// eslint-disable-next-line no-console
Sentry
.
captureException
(
new
Error
(
'
Incorrect network
'
),
{
extra
:
{
networkType
,
networkSubType
}
});
console
.
error
(
`Incorrect network: NETWORK_TYPE=
${
networkType
}
NETWORK_SUB_TYPE=
${
networkSubType
}
`
);
}
}
return
`/
${
networkType
}
/
${
networkSubType
}
/
${
path
}
`
;
return
`/
${
networkType
}
/
${
networkSubType
}
/
${
path
}
`
;
...
...
lib/client/fetch.ts
View file @
989696f2
import
*
as
Sentry
from
'
@sentry/nextjs
'
;
export
interface
ErrorType
<
T
>
{
export
interface
ErrorType
<
T
>
{
error
?:
T
;
error
?:
T
;
status
:
Response
[
'
status
'
];
status
:
Response
[
'
status
'
];
...
@@ -13,10 +15,15 @@ export default function clientFetch<Success, Error>(path: string, init?: Request
...
@@ -13,10 +15,15 @@ export default function clientFetch<Success, Error>(path: string, init?: Request
status
:
response
.
status
,
status
:
response
.
status
,
statusText
:
response
.
statusText
,
statusText
:
response
.
statusText
,
}),
}),
()
=>
Promise
.
reject
({
()
=>
{
status
:
response
.
status
,
const
error
=
{
statusText
:
response
.
statusText
,
status
:
response
.
status
,
}),
statusText
:
response
.
statusText
,
};
Sentry
.
captureException
(
new
Error
(
'
Client fetch failed
'
),
{
extra
:
error
,
tags
:
{
source
:
'
fetch
'
}
});
return
Promise
.
reject
(
error
);
},
);
);
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment