@@ -45,7 +45,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
4545 let
4646 contentKeyByteList = ContentKeyByteList .init (hexToSeqByte (contentKeyBytes))
4747 contentKey = decode (contentKeyByteList).valueOr:
48- raise invalidKeyErr ()
48+ raise invalidContentKeyError ()
4949 contentId = toContentId (contentKey)
5050
5151 n.portalProtocol.getLocalContent (contentKeyByteList, contentId).isErrOr:
@@ -66,7 +66,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
6666 let
6767 contentKeyByteList = ContentKeyByteList .init (hexToSeqByte (contentKeyBytes))
6868 contentKey = decode (contentKeyByteList).valueOr:
69- raise invalidKeyErr ()
69+ raise invalidContentKeyError ()
7070 contentId = toContentId (contentKey)
7171
7272 n.portalProtocol.getLocalContent (contentKeyByteList, contentId).isErrOr:
@@ -96,7 +96,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
9696 let
9797 contentKeyByteList = ContentKeyByteList .init (hexToSeqByte (contentKeyBytes))
9898 _ = decode (contentKeyByteList).valueOr:
99- raise invalidKeyErr ()
99+ raise invalidContentKeyError ()
100100 offerValueBytes = hexToSeqByte (contentValueBytes)
101101
102102 # Note: Not validating content as this would have a high impact on bridge
@@ -128,15 +128,15 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
128128 contentKeyByteList = ContentKeyByteList .init (hexToSeqByte (contentKeyBytes))
129129 offerValueBytes = hexToSeqByte (contentValueBytes)
130130 contentId = n.portalProtocol.toContentId (contentKeyByteList).valueOr:
131- raise invalidKeyErr ()
131+ raise invalidContentKeyError ()
132132
133133 n.portalProtocol.storeContent (contentKeyByteList, contentId, offerValueBytes)
134134
135135 rpcServer.rpc (" portal_historyLocalContent" ) do (contentKeyBytes: string ) -> string :
136136 let
137137 contentKeyByteList = ContentKeyByteList .init (hexToSeqByte (contentKeyBytes))
138138 contentId = n.portalProtocol.toContentId (contentKeyByteList).valueOr:
139- raise invalidKeyErr ()
139+ raise invalidContentKeyError ()
140140
141141 valueBytes = n.portalProtocol.getLocalContent (contentKeyByteList, contentId).valueOr:
142142 raise contentNotFoundErr ()
@@ -145,7 +145,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
145145
146146 rpcServer.rpc (" portal_historyGetBlockBody" ) do (headerBytes: string ) -> string :
147147 let header = decodeRlp (hexToSeqByte (headerBytes), Header ).valueOr:
148- raise invalidRequest ((code: - 39005 , msg: " Failed to decode header: " & error))
148+ raise applicationError ((code: - 39010 , msg: " Failed to decode header: " & error))
149149
150150 let blockBody = (await n.getBlockBody (header)).valueOr:
151151 raise contentNotFoundErr ()
@@ -154,7 +154,7 @@ proc installPortalHistoryApiHandlers*(rpcServer: RpcServer, n: HistoryNetwork) =
154154
155155 rpcServer.rpc (" portal_historyGetReceipts" ) do (headerBytes: string ) -> string :
156156 let header = decodeRlp (hexToSeqByte (headerBytes), Header ).valueOr:
157- raise invalidRequest ((code: - 39005 , msg: " Failed to decode header: " & error))
157+ raise applicationError ((code: - 39010 , msg: " Failed to decode header: " & error))
158158
159159 let receipts = (await n.getReceipts (header)).valueOr:
160160 raise contentNotFoundErr ()
0 commit comments