rchain / rchain

Blockchain (smart contract) platform using CBC-Casper proof of stake + Rholang for concurrent execution.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change error messages in reducer

hilltracer opened this issue · comments

res <- Sync[M]
.delay(Base16.encode(bytes.toByteArray))
.handleErrorWith { ex =>
ReduceError(
s"Error: exception was thrown when encoding input byte array to hexadecimal string: ${ex.getMessage}"
).raiseError[M, String]
}
.map(str => Expr(GString(str)): Par)

We should remove "Error:" prefix from here and from similar messages, but also exception was thrown is not necessary and duplication of the fact that ReduceError is created.

If you test this error you will see that we are missing information about the location in the source where the error happened. This is inconvenient so at least we should try to provide some context for users to find the position in their source code.

If error is just transformed to another error adaptError method can be used instead of handleErrorWith.