Skip to content

Commit

Permalink
fix bug with validation error
Browse files Browse the repository at this point in the history
  • Loading branch information
daico007 committed Sep 11, 2023
1 parent d93b4f3 commit 0b15fce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
pydantic-version: ["1", "2"]
pydantic-version: ["2"]

defaults:
run:
Expand Down
8 changes: 6 additions & 2 deletions gmso/core/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from typing import Iterable

from lxml import etree
from pydantic import ValidationError

try:
from pydantic.v1 import ValidationError
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
from pydantic import ValidationError

from gmso.core.element import element_by_symbol
from gmso.exceptions import (
Expand Down Expand Up @@ -574,7 +578,7 @@ def xml_from_forcefield_utilities(cls, filename):
try:
loader = GMSOFFs()
ff = loader.load(filename).to_gmso_ff()
except (ForceFieldParseError, FileNotFoundError, ValidationError):
except (ForceFieldParseError, ValidationError):
loader = FoyerFFs()
ff = loader.load(filename).to_gmso_ff()
return ff
Expand Down

0 comments on commit 0b15fce

Please sign in to comment.