Skip to content

Commit

Permalink
chore: fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Jan 10, 2024
1 parent 0b7a545 commit aca05c3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/connector/src/MosDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,11 @@ export class MosDevice implements IMOSDevice {
private badRoAckReply(xmlRoAck: AnyXML) {
try {
const roAck = MosModel.XMLMosROAck.fromXML(xmlRoAck, this.strict)
return new Error(`Reply: ${roAck.toString()}`)
return new Error(
`Reply: ${this.mosTypes.mosString128.stringify(
roAck.Status
)}, ID: ${this.mosTypes.mosString128.stringify(roAck.ID)}`
)
} catch (e) {
return new Error(`Reply: Unparsable reply: ${safeStringify(xmlRoAck).slice(0, 200)}`)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/connector/src/__tests__/Profile0-non-strict.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('Profile 0 - non strict', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*Invalid timestamp/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*Invalid timestamp/i)
})
test('requestMachineInfo - missing <opTime>', async () => {
// Prepare mock server response:
Expand Down Expand Up @@ -236,6 +236,6 @@ describe('Profile 0 - non strict', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*Invalid timestamp/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*Invalid timestamp/i)
})
})
8 changes: 4 additions & 4 deletions packages/connector/src/__tests__/Profile0.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ describe('Profile 0', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*listMachInfo.opTime.*Invalid timestamp/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*listMachInfo.opTime.*Invalid timestamp/i)
})
test('requestMachineInfo - missing <time>', async () => {
// Prepare mock server response:
Expand All @@ -302,7 +302,7 @@ describe('Profile 0', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*listMachInfo.time.*Invalid input/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*listMachInfo.time.*Invalid input/i)
})
test('requestMachineInfo - empty <time>', async () => {
// Prepare mock server response:
Expand All @@ -321,7 +321,7 @@ describe('Profile 0', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*listMachInfo.time.*Invalid input/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*listMachInfo.time.*Invalid input/i)
})
test('requestMachineInfo - bad formatted <time>', async () => {
// Prepare mock server response:
Expand All @@ -340,6 +340,6 @@ describe('Profile 0', () => {
})
expect(mockReply).toHaveBeenCalledTimes(1)

expect(String(caughtError)).toMatch(/error when parsing reply.*listMachInfo.time.*Invalid timestamp/i)
expect(String(caughtError)).toMatch(/Unable to parse MOS reply.*listMachInfo.time.*Invalid timestamp/i)
})
})
2 changes: 1 addition & 1 deletion packages/connector/src/__tests__/Profile2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ describe('Profile 2', () => {
error = e
}
expect(error).toBeTruthy()
expect(`${error}`).toMatch(/Reply from NRCS.*rundown not under MOS control/)
expect(`${error}`).toMatch(/Reply.*rundown not under MOS control/)
})
test('onMetadataReplace', async () => {
// Fake incoming message on socket:
Expand Down

0 comments on commit aca05c3

Please sign in to comment.