Skip to content

Commit 975b313

Browse files
authored
Merge pull request #507 from devforth/feature/AdminForth/1326/bool-filters-doesn't-work-
fix: don't throw an error, when user tries to save 1/0 in bool field …
2 parents 52c5694 + 75fb2e7 commit 975b313

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

adminforth/dataConnectors/baseConnector.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,13 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
471471
return this.setFieldValue(field, null);
472472
}
473473
if (typeof value !== 'boolean') {
474-
throw new Error(`Value is not a boolean. Field ${field.name} with type is ${field.type}, but got value: ${value} with type ${typeof value}`);
474+
const errorMessage = `Value is not a boolean. Field ${field.name} with type is ${field.type}, but got value: ${value} with type ${typeof value}`;
475+
if (value !== 1 && value !== 0) {
476+
throw new Error(errorMessage);
477+
} else {
478+
afLogger.warn(errorMessage);
479+
afLogger.warn(`Ignore this warn, if you are using an sqlite database`);
480+
}
475481
}
476482
return this.setFieldValue(field, value);
477483
}

0 commit comments

Comments
 (0)