From 2c4b1e690634c3ee8466a4e0dcef83f92c8ec523 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Fri, 18 Mar 2022 16:17:51 -0600 Subject: [PATCH] Upraises (#57) * cleanup manifest * make block a ref type * use upraises * more upraises --- dagger/blocktype.nim | 4 +++- dagger/chunker.nim | 4 +++- dagger/conf.nim | 4 +++- dagger/manifest/coders.nim | 4 +++- dagger/manifest/manifest.nim | 4 +++- dagger/rest/api.nim | 5 ++++- dagger/stores/blockstore.nim | 10 ++++++---- dagger/stores/cachestore.nim | 6 ++++-- dagger/stores/fsstore.nim | 4 +++- dagger/stores/networkstore.nim | 4 +++- dagger/utils/fileutils.nim | 4 +++- 11 files changed, 38 insertions(+), 15 deletions(-) diff --git a/dagger/blocktype.nim b/dagger/blocktype.nim index 2b9b9bb1..0f7c37ba 100644 --- a/dagger/blocktype.nim +++ b/dagger/blocktype.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import pkg/libp2p import pkg/stew/byteutils diff --git a/dagger/chunker.nim b/dagger/chunker.nim index a6ad5dbe..0889f29e 100644 --- a/dagger/chunker.nim +++ b/dagger/chunker.nim @@ -9,7 +9,9 @@ # TODO: This is super inneficient and needs a rewrite, but it'll do for now -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import pkg/chronicles import pkg/questionable diff --git a/dagger/conf.nim b/dagger/conf.nim index 1614c196..049ff1d6 100644 --- a/dagger/conf.nim +++ b/dagger/conf.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import std/os import std/options diff --git a/dagger/manifest/coders.nim b/dagger/manifest/coders.nim index 1be35c85..045dbdd5 100644 --- a/dagger/manifest/coders.nim +++ b/dagger/manifest/coders.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import std/tables diff --git a/dagger/manifest/manifest.nim b/dagger/manifest/manifest.nim index 154c7960..aa8e5a49 100644 --- a/dagger/manifest/manifest.nim +++ b/dagger/manifest/manifest.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import std/tables import pkg/libp2p/protobuf/minprotobuf diff --git a/dagger/rest/api.nim b/dagger/rest/api.nim index 2d18c4dc..8fbb417f 100644 --- a/dagger/rest/api.nim +++ b/dagger/rest/api.nim @@ -7,7 +7,10 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} + import std/sequtils diff --git a/dagger/stores/blockstore.nim b/dagger/stores/blockstore.nim index 771eeaa6..4e8f39a5 100644 --- a/dagger/stores/blockstore.nim +++ b/dagger/stores/blockstore.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import pkg/chronos import pkg/libp2p @@ -26,7 +28,7 @@ method getBlock*( ## Get a block from the stores ## - doAssert(false, "Not implemented!") + raiseAssert("Not implemented!") method putBlock*( s: BlockStore, @@ -34,7 +36,7 @@ method putBlock*( ## Put a block to the blockstore ## - doAssert(false, "Not implemented!") + raiseAssert("Not implemented!") method delBlock*( s: BlockStore, @@ -42,7 +44,7 @@ method delBlock*( ## Delete a block/s from the block store ## - doAssert(false, "Not implemented!") + raiseAssert("Not implemented!") method hasBlock*(s: BlockStore, cid: Cid): bool {.base.} = ## Check if the block exists in the blockstore diff --git a/dagger/stores/cachestore.nim b/dagger/stores/cachestore.nim index 2bf5ab58..8f736520 100644 --- a/dagger/stores/cachestore.nim +++ b/dagger/stores/cachestore.nim @@ -7,10 +7,12 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} + import std/options -import std/sequtils import pkg/chronicles import pkg/chronos diff --git a/dagger/stores/fsstore.nim b/dagger/stores/fsstore.nim index 163c1ee1..2b125842 100644 --- a/dagger/stores/fsstore.nim +++ b/dagger/stores/fsstore.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import std/os diff --git a/dagger/stores/networkstore.nim b/dagger/stores/networkstore.nim index 20efed09..0b361caa 100644 --- a/dagger/stores/networkstore.nim +++ b/dagger/stores/networkstore.nim @@ -7,7 +7,9 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import pkg/chronicles import pkg/chronos diff --git a/dagger/utils/fileutils.nim b/dagger/utils/fileutils.nim index 53b8b46e..eeaba77f 100644 --- a/dagger/utils/fileutils.nim +++ b/dagger/utils/fileutils.nim @@ -9,7 +9,9 @@ ## Partially taken from nim beacon chain -{.push raises: [Defect].} +import pkg/upraises + +push: {.upraises: [].} import std/strutils