Read a Thrift application exception
()
| 237 | |
| 238 | /** Read a Thrift application exception */ |
| 239 | readException(): { message: string; type: number } { |
| 240 | let message = '' |
| 241 | let type = 0 |
| 242 | this.readStruct((reader, fieldId, fieldType) => { |
| 243 | if (fieldId === 1 && fieldType === TYPE_STRING) { |
| 244 | message = reader.readString() |
| 245 | } else if (fieldId === 2 && fieldType === TYPE_I32) { |
| 246 | type = reader.readI32() |
| 247 | } else { |
| 248 | reader.skip(fieldType) |
| 249 | } |
| 250 | }) |
| 251 | return { message, type } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | export { TYPE_BOOL, TYPE_I32, TYPE_I64, TYPE_LIST, TYPE_STRING, TYPE_STRUCT } |
no test coverage detected