mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 23:36:16 -04:00
Added in another error check
This commit is contained in:
parent
ef177a7ba0
commit
101bab2d15
1 changed files with 4 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import Operation from "../Operation.mjs";
|
||||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
* Manchester encoding operation
|
||||
|
@ -40,9 +41,11 @@ class ManchesterEncode extends Operation {
|
|||
if (bit == 0){
|
||||
encoding.push(1);
|
||||
encoding.push(0);
|
||||
} else {
|
||||
} else if (bit == 1){
|
||||
encoding.push(0);
|
||||
encoding.push(1);
|
||||
} else {
|
||||
throw new OperationError(`Invalid input character ${bit}. Input should be in binary.`);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue