Skip to content

Commit

Permalink
chore: reorder parameters checks
Browse files Browse the repository at this point in the history
  • Loading branch information
RDWimmers committed Jul 19, 2024
1 parent f2b92f8 commit 82234a5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/nuclei/client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,16 @@ def call_endpoint(
f"Application not available, please select one of the following valid applications {self.applications}"
)

if not isinstance(version, str):
raise TypeError(
f"Expected keyword-argument `version` to be of type <class 'str'>, but got type: {type(version)}"
)

if version not in self.get_versions(app):
raise ValueError(
f"Application version not available, please select one of the following valid versions {self.get_versions(app)}"
)

if not isinstance(endpoint, str):
raise TypeError(
f"Expected positional argument `endpoint` to be of type <class 'str'>, but got type: {type(endpoint)}"
Expand All @@ -426,15 +436,6 @@ def call_endpoint(
raise ValueError(
f'Expected value of keyword-argument `methode` to be one of ["auto", "get", "post"] , but got: {methode}'
)
if not isinstance(version, str):
raise TypeError(
f"Expected keyword-argument `version` to be of type <class 'str'>, but got type: {type(version)}"
)

if version not in self.get_versions(app):
raise ValueError(
f"Application version not available, please select one of the following valid versions {self.get_versions(app)}"
)

if not (schema is None or isinstance(schema, (str, dict))):
raise TypeError(
Expand Down

0 comments on commit 82234a5

Please sign in to comment.