Skip to content

Commit

Permalink
catch errors when applying edit filter dialog and show them as valida…
Browse files Browse the repository at this point in the history
…tion error
  • Loading branch information
volkanceylan committed Jul 21, 2023
1 parent bc7cc68 commit 4a6fae4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/corelib/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="jquery" />
/// <reference types="jquery.validation" />
import { PropertyItem, executeOnceWhenVisible, executeEverytimeWhenVisible, DialogButton, PropertyItemsData, Lookup, ColumnSelection, ListRequest, ServiceOptions, ListResponse, ArgumentNullException, SaveRequest, HandleRouteEventArgs, DeleteResponse, Exception, RetrieveResponse, RetrieveRequest, SaveResponse, UndeleteResponse, ServiceRequest, ServiceResponse } from '@serenity-is/corelib/q';
import { PropertyItem, executeOnceWhenVisible, executeEverytimeWhenVisible, DialogButton, PropertyItemsData, Lookup, ColumnSelection, ListRequest, ServiceOptions, ListResponse, SaveRequest, HandleRouteEventArgs, DeleteResponse, Exception, RetrieveResponse, RetrieveRequest, SaveResponse, UndeleteResponse, ServiceRequest, ServiceResponse } from '@serenity-is/corelib/q';
export { ColumnSelection, Criteria, DeleteRequest, DeleteResponse, ISlickFormatter, ListRequest, ListResponse, PropertyItem, PropertyItemsData, RetrieveColumnSelection, RetrieveLocalizationRequest, RetrieveLocalizationResponse, RetrieveRequest, RetrieveResponse, SaveRequest, SaveRequestWithAttachment, SaveResponse, SaveWithLocalizationRequest, ServiceError, ServiceOptions, ServiceRequest, ServiceResponse, SummaryType, UndeleteRequest, UndeleteResponse } from '@serenity-is/corelib/q';
import { PagerOptions, RemoteView, Format, Formatter, RemoteViewOptions } from '@serenity-is/corelib/slick';
export { Formatter } from '@serenity-is/corelib/slick';
Expand Down Expand Up @@ -1553,7 +1553,7 @@ declare abstract class BaseFiltering implements IFiltering, IQuickFiltering {
getCriteria(): CriteriaWithText;
loadState(state: any): void;
saveState(): any;
protected argumentNull(): ArgumentNullException;
protected argumentNull(): Error;
validateEditorValue(value: string): string;
getEditorValue(): string;
getEditorText(): any;
Expand Down
2 changes: 1 addition & 1 deletion packages/corelib/src/ui/filtering/filtering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export abstract class BaseFiltering implements IFiltering, IQuickFiltering {
}

protected argumentNull() {
return new ArgumentNullException('value', localText('Controls.FilterPanel.ValueRequired'));
return new Error(localText('Controls.FilterPanel.ValueRequired'));
}

validateEditorValue(value: string) {
Expand Down
9 changes: 8 additions & 1 deletion packages/corelib/src/ui/filtering/filterpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,14 @@ export class FilterPanel extends FilterWidgetBase<any> {
line.rightParen = row.children('div.l')
.children('a.rightparen').hasClass('active');
filtering.set_operator({ key: op });
var criteria = filtering.getCriteria();
var criteria;
try {
criteria = filtering.getCriteria();
}
catch (ex) {
errorText = ex.message ?? ex.toString();
break;
}
line.criteria = criteria.criteria;
line.state = filtering.saveState();
line.displayText = criteria.displayText;
Expand Down
2 changes: 1 addition & 1 deletion src/Serenity.Scripts/wwwroot/Serenity.CoreLib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4726,7 +4726,7 @@ declare namespace Serenity {
getCriteria(): CriteriaWithText;
loadState(state: any): void;
saveState(): any;
protected argumentNull(): Q.ArgumentNullException;
protected argumentNull(): Error;
validateEditorValue(value: string): string;
getEditorValue(): string;
getEditorText(): any;
Expand Down

0 comments on commit 4a6fae4

Please sign in to comment.