MCPcopy Index your code
hub / github.com/simstudioai/sim / checkException

Function checkException

apps/sim/connectors/evernote/evernote.ts:102–122  ·  view source on GitHub ↗

* Checks for Evernote-specific exceptions in response struct fields 1-3.

(r: ThriftReader, fieldId: number, fieldType: number)

Source from the content-addressed store, hash-verified

100 * Checks for Evernote-specific exceptions in response struct fields 1-3.
101 */
102function checkException(r: ThriftReader, fieldId: number, fieldType: number): boolean {
103 if ((fieldId === 1 || fieldId === 2) && fieldType === TYPE_STRUCT) {
104 let errorCode = 0
105 let message = ''
106 r.readStruct((r2, fid, ftype) => {
107 if (fid === 1 && ftype === TYPE_I32) errorCode = r2.readI32()
108 else if (fid === 2 && ftype === TYPE_STRING) message = r2.readString()
109 else r2.skip(ftype)
110 })
111 throw new Error(`Evernote error (${errorCode}): ${message}`)
112 }
113 if (fieldId === 3 && fieldType === TYPE_STRUCT) {
114 let identifier = ''
115 r.readStruct((r2, fid, ftype) => {
116 if (fid === 1 && ftype === TYPE_STRING) identifier = r2.readString()
117 else r2.skip(ftype)
118 })
119 throw new Error(`Evernote not found: ${identifier}`)
120 }
121 return false
122}
123
124interface Notebook {
125 guid: string

Callers 4

apiListNotebooksFunction · 0.85
apiListTagsFunction · 0.85
apiFindNotesMetadataFunction · 0.85
apiGetNoteFunction · 0.85

Calls 4

readStructMethod · 0.80
readI32Method · 0.80
readStringMethod · 0.80
skipMethod · 0.80

Tested by

no test coverage detected