Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyhocon/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import codecs
from pyparsing import Forward, Keyword, QuotedString, Word, Literal, Suppress, Regex, Optional, SkipTo, ZeroOrMore, \
Group, lineno, col, TokenConverter, replaceWith, alphanums, alphas8bit, ParseSyntaxException, StringEnd
from pyparsing import ParserElement
from pyparsing import ParserElement, ParseBaseException
from pyhocon.config_tree import ConfigTree, ConfigSubstitution, ConfigList, ConfigValues, ConfigUnquotedString, \
ConfigInclude, NoneValue, ConfigQuotedString
from pyhocon.exceptions import ConfigSubstitutionException, ConfigMissingException
from pyhocon.exceptions import ConfigException, ConfigSubstitutionException, ConfigMissingException
import logging

use_urllib2 = False
Expand Down Expand Up @@ -269,7 +269,10 @@ def include_config(token):
# the file can be { ... } where {} can be omitted or []
config_expr = ZeroOrMore(comment_eol | eol) + (list_expr | root_dict_expr | inside_root_dict_expr) + ZeroOrMore(
comment_eol | eol_comma)
config = config_expr.parseString(content, parseAll=True)[0]
try:
config = config_expr.parseString(content, parseAll=True)[0]
except ParseBaseException as e:
raise ConfigException(str(e))
if resolve:
ConfigParser.resolve_substitutions(config)
return config
Expand Down