Skip to content
Discussion options

You must be logged in to vote

I am not sure, that there is a commonly accepted way for this, but I can suggest to use something like Result Monad, which is effectefly just returning table {isOperationSuccessful, problemWithOperation} and return exception only in cases of invalid output of some incorrect usage of function

Update: Not a table, just one or two values for easly handle like in golang:

local result, err = true, "haha"

if err ~= nil then
print(err)
end

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Lordmau5
Comment options

@SquidDev
Comment options

@Lordmau5
Comment options

@SirEdvin
Comment options

@SirEdvin
Comment options

Answer selected by Lordmau5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants