Added in another error check
This commit is contained in:
parent
ef177a7ba0
commit
101bab2d15
@ -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…
x
Reference in New Issue
Block a user