base62 icon indicating copy to clipboard operation
base62 copied to clipboard

Error checking in decoder

Open gavv opened this issue 9 years ago • 0 comments

Hello!

Currently there is no error checking in decoder, e.g. in DecodeToInt64():

idx = strings.IndexRune(e.encode, v)
...
c = int64(idx) * ...

strings.IndexRune() could return -1 here.

Would you accept a pull request that adds error checking?

What approach would you prefer?

  • panic() on error;
  • change return type from int64 to int64, error (this will break API);
  • add new function with int64, error return type?

gavv avatar Apr 27 '16 12:04 gavv