Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mechatroner committed Feb 18, 2018
1 parent 7b12366 commit c81228a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Expand Up @@ -550,11 +550,15 @@ function enable_for_selected_delim(policy) {
atom.notifications.addError('Please select exactly one character to use as rainbow delimiter');
return;
}
// FIXME check simple delims too
var standard_delims = '\t|,;';
var simple_delims = '\t !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~';
if (simple_delims.indexOf(rainbow_delim) == -1) {
atom.notifications.addError('Selected separator is not supported');
return;
}
if (policy == 'quoted' && standard_delims.indexOf(rainbow_delim) == -1) {
// By limiting number of standard dialect delims we are helping users to make the right dialect choice
atom.notifications.addError('"Standard" dialect should not be used with exotic delimiters. Try "Simple" dialect instead');
atom.notifications.addError('"Standard" dialect should not be used with unconventional separators. Try "Simple" dialect instead');
return;
}
do_set_rainbow_grammar(editor, rainbow_delim, policy);
Expand Down

0 comments on commit c81228a

Please sign in to comment.