* Package wide error throwing class
| 20 | * Package wide error throwing class |
| 21 | */ |
| 22 | class ErrorThrower { |
| 23 | |
| 24 | throwColumnNamesLengthError = (ndframe: NDframe, columns: Array<string>): void => { |
| 25 | const msg = `ParamError: Column names length mismatch. You provided a column of length ${columns.length} but Ndframe columns has length of ${ndframe.shape[1]}` |
| 26 | throw new Error(msg) |
| 27 | } |
| 28 | |
| 29 | throwIndexLengthError = (ndframe: NDframe, index: Array<string | number>): void => { |
| 30 | const msg = `IndexError: You provided an index of length ${index.length} but Ndframe rows has length of ${ndframe.shape[0]}` |
| 31 | throw new Error(msg) |
| 32 | } |
| 33 | |
| 34 | throwIndexDuplicateError = (): void => { |
| 35 | const msg = `IndexError: Row index must contain unique values` |
| 36 | throw new Error(msg) |
| 37 | } |
| 38 | |
| 39 | throwColumnDuplicateError = (): void => { |
| 40 | const msg = `ColumnIndexError: Column index must contain unique values` |
| 41 | throw new Error(msg) |
| 42 | } |
| 43 | |
| 44 | throwDtypesLengthError = (ndframe: NDframe, dtypes: Array<string>): void => { |
| 45 | const msg = `DtypeError: You provided a dtype array of length ${dtypes.length} but Ndframe columns has length of ${ndframe.shape[1]}` |
| 46 | throw new Error(msg) |
| 47 | } |
| 48 | |
| 49 | throwDtypeNotSupportedError = (dtype: string): void => { |
| 50 | const msg = `DtypeError: Dtype "${dtype}" not supported. dtype must be one of "${DATA_TYPES}"` |
| 51 | throw new Error(msg) |
| 52 | } |
| 53 | |
| 54 | throwDtypeWithoutColumnError = (): void => { |
| 55 | const msg = `DtypeError: columns parameter must be provided when dtypes parameter is provided` |
| 56 | throw new Error(msg) |
| 57 | } |
| 58 | |
| 59 | throwColumnLengthError = (ndframe: NDframe | DataFrame, arrLen: number): void => { |
| 60 | const msg = `ParamError: Column data length mismatch. You provided data with length ${arrLen} but Ndframe has column of length ${ndframe.shape[0]}` |
| 61 | throw new Error(msg) |
| 62 | } |
| 63 | |
| 64 | throwRowLengthError = (ndframe: NDframe, arrLen: number): void => { |
| 65 | const msg = `ParamError: Row data length mismatch. You provided data with length ${arrLen} but Ndframe has row of length ${ndframe.shape[0]}` |
| 66 | throw new Error(msg) |
| 67 | } |
| 68 | |
| 69 | throwColumnNotFoundError = (ndframe: DataFrame | NDframe): void => { |
| 70 | const msg = `ParamError: Column not found!. Column name must be one of ${ndframe.columns}` |
| 71 | throw new Error(msg) |
| 72 | } |
| 73 | |
| 74 | throwNotImplementedError = (): void => { |
| 75 | const msg = `Method not implemented` |
| 76 | throw new Error(msg) |
| 77 | } |
| 78 | |
| 79 | throwIlocRowIndexError = (): void => { |
nothing calls this directly
no outgoing calls
no test coverage detected