Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Commit

Permalink
Fix error message for bytes __add__ method
Browse files Browse the repository at this point in the history
Python 3.6+
  • Loading branch information
abonie committed Aug 20, 2017
1 parent 2598625 commit f5c7f09
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion batavia/types/Bytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,20 @@ Bytes.prototype.__add__ = function(other) {
types.Str,
types.Tuple ])) {
// does not concat with all these
throw new exceptions.TypeError.$pyclass("can't concat bytes to " + type_name(other))
switch(constants.BATAVIA_MAGIC) {
case constants.BATAVIA_MAGIC_34:
case constants.BATAVIA_MAGIC_35a0:
case constants.BATAVIA_MAGIC_35:
case constants.BATAVIA_MAGIC_353:
throw new exceptions.TypeError.$pyclass(
"can't concat bytes to " + type_name(other)
)
case constants.BATAVIA_MAGIC_36:
throw new exceptions.TypeError.$pyclass(
"can't concat " + type_name(other) + " to bytes"
)
}

} else {
throw new exceptions.NotImplementedError.$pyclass('Bytes.__add__ has not been implemented')
}
Expand Down

0 comments on commit f5c7f09

Please sign in to comment.