Skip to content

Commit

Permalink
Merge branch 'feat/ZOS-5363' into 'main'
Browse files Browse the repository at this point in the history
Resolve ZOS-5363 "Feat/"

Closes ZOS-5363

See merge request sec.app.web/zeppos/zml!6
  • Loading branch information
Tao HUANG(黄涛-前端开发工程师) committed Aug 19, 2024
2 parents 14a5782 + 1a9f9ef commit adfcf7d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zeppos/zml",
"version": "0.0.31",
"version": "0.0.33",
"description": "A Mini Library of ZeppOS MiniApp",
"zeppos": true,
"typings": "./zml.d.ts",
Expand Down
17 changes: 12 additions & 5 deletions src/core/side/messaging/messaging-plugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { messaging } from './side-message.js'

function formatTime(date) {
return date.toTimeString().split(' ')[0];
return date.toTimeString().split(' ')[0]
}

function addBaseURL(opts) {
Expand Down Expand Up @@ -66,15 +66,22 @@ export function messagingPlugin() {
})
})
.catch((e) => {
this.error('http error url=%s', req.params.url, e.message)
this.error('http error url=%s', req.params.url, e.message, e.data)
return res({
code: 1,
code: e.code,
message: e.message,
data: e.data,
})
})
.finally(() => {
const end = new Date()
this.log('http url=%s %d %d elapsed=%dms', req.params.url, formatTime(start), formatTime(end), end.getTime() - start.getTime())
const end = new Date()
this.log(
'http url=%s %s %s elapsed=%dms',
req.params.url,
formatTime(start),
formatTime(end),
end.getTime() - start.getTime(),
)
})
},
}
Expand Down
9 changes: 6 additions & 3 deletions src/shared/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class SessionMgr {
return `${session.id}:${session.type}`
}

newSession(id, type, size ,ctx) {
const newSession = new Session(id, type, size ,ctx)
newSession(id, type, size, ctx) {
const newSession = new Session(id, type, size, ctx)
this.sessions.set(this.key(newSession), newSession)
return newSession
}
Expand Down Expand Up @@ -1142,7 +1142,10 @@ export class MessageBuilder extends EventBus {
timer = null

requestPromiseTask.reject(
new MessageError(MessageErrorCode.REQUEST_TIME_OUT, `request id=${requestId} timeout in ${opts.timeout}ms`),
new MessageError(
MessageErrorCode.REQUEST_TIME_OUT,
`request id=${requestId} timeout in ${opts.timeout}ms`,
),
)
}, opts.timeout)

Expand Down

0 comments on commit adfcf7d

Please sign in to comment.