json_block: true,
block: this.toJSON()
}
- const res = await rpc.post('process', data)
- if (res == null || typeof res !== 'object' || !('hash' in res) || typeof res.hash !== 'string') {
- throw new Error('Block could not be processed', { cause: res })
+ try {
+ const res = await rpc.post('process', data)
+ if (res == null || typeof res !== 'object' || !('hash' in res) || typeof res.hash !== 'string') {
+ throw new Error('RPC process request received incomplete response', { cause: res })
+ }
+ return res.hash
+ } catch (err) {
+ throw new Error('Block could not be processed', { cause: err })
}
- return res.hash
}
/**