Skip to content

Commit

Permalink
fix: fetch remains pending when error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Nov 10, 2024
1 parent 786c515 commit c719049
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"autoprefixer": "^9.7.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.5",
"chobitsu": "^1.8.1",
"chobitsu": "^1.8.4",
"core-js": "^3.37.1",
"css-loader": "^3.4.2",
"es-check": "^6.2.1",
Expand Down
17 changes: 17 additions & 0 deletions src/Network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,22 @@ export default class Network extends Tool {

request.render()
}
_loadingFailed = (params) => {
const request = this._requests[params.requestId]
if (!this._isRecording || !request) {
return
}

const time = params.timestamp * 1000
request.time = time - request.startTime
request.displayTime = ms(request.time)

request.hasErr = true
request.status = 0
request.done = true

request.render()
}
_copyCurl = () => {
const request = this._selectedRequest

Expand Down Expand Up @@ -322,6 +338,7 @@ export default class Network extends Tool {
network.on('responseReceivedExtraInfo', this._resReceivedExtraInfo)
network.on('responseReceived', this._resReceived)
network.on('loadingFinished', this._loadingFinished)
network.on('loadingFailed', this._loadingFailed)

emitter.on(emitter.SCALE, this._updateScale)
}
Expand Down

0 comments on commit c719049

Please sign in to comment.