*Catch error in stream and close the stream
This commit is contained in:
parent
48ef0411b3
commit
d37926dd84
|
@ -230,9 +230,14 @@ export default class IpfsProvider extends BaseProvider {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
fetchMethod?.(hash, urlPath, (data: Buffer) => {
|
fetchMethod?.(hash, urlPath, (data: Buffer) => {
|
||||||
streamWriter.write(data);
|
streamWriter.write(data);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
streamWriter.releaseLock();
|
streamWriter.releaseLock();
|
||||||
return reqStream.close();
|
return reqStream.close();
|
||||||
|
})
|
||||||
|
.catch((e: any) => {
|
||||||
|
streamWriter.releaseLock();
|
||||||
|
reqStream.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
Reference in New Issue