Skip to content

Commit 18d0d93

Browse files
authored
improve error message
1 parent 9d47b59 commit 18d0d93

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

azure/functions/decorators/function_app.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,24 +278,40 @@ def __init__(self, *args, **kwargs):
278278
self._app_script_file: str = SCRIPT_FILE_NAME
279279

280280
def _invoke_df_decorator(self, df_decorator):
281+
"""
282+
Invoke a Durable Functions decorator from the DF SDK, and store the
283+
resulting :class:`FunctionBuilder` object within the `DecoratorApi`.
284+
285+
"""
281286

282287
@self._configure_function_builder
283288
def wrap(fb):
284289
def decorator():
285-
fb2 = df_decorator(fb._function._func)
290+
# override function builder with result of decorator
291+
fb = df_decorator(fb._function._func)
292+
293+
# remove old function builder from `self` and replace
294+
# it with the result of the DF decorator
286295
self._function_builders.pop()
287-
self._function_builders.append(fb2)
296+
self._function_builders.append(fb)
288297
return fb2
289298
return decorator()
290299
return wrap
291300

292301
def _get_durable_blueprint(self):
302+
"""Attempt to import the Durable Functions SDK from which DF decorators are
303+
implemented.
304+
"""
305+
293306
try:
294307
import azure.durable_functions as df
295308
df_bp = df.Blueprint()
296309
return df_bp
297310
except ImportError:
298-
raise Exception("TBD")
311+
error_message = "Attempted to use a Durable Functions decorator, "\
312+
"but the `azure-functions-durable` SDK package could not be found. "\
313+
"Please install `azure-functions-durable` to use Durable Functions."
314+
raise Exception(error_message)
299315

300316
@property
301317
def app_script_file(self) -> str:

0 commit comments

Comments
 (0)