diff --git a/sdk/dotnet/Pulumi/Deployment/Deployment.Logger.cs b/sdk/dotnet/Pulumi/Deployment/Deployment.Logger.cs index 1acc61f9a..ce0334ed8 100644 --- a/sdk/dotnet/Pulumi/Deployment/Deployment.Logger.cs +++ b/sdk/dotnet/Pulumi/Deployment/Deployment.Logger.cs @@ -66,8 +66,8 @@ namespace Pulumi } /// - /// Error logs a fatal error to indicate that the tool should stop processing resource - /// operations immediately. + /// Logs a fatal condition. Consider raising an exception + /// after calling this method to stop the Pulumi program. /// Task ILogger.ErrorAsync(string message, Resource? resource, int? streamId, bool? ephemeral) => ErrorAsync(message, resource, streamId, ephemeral); diff --git a/sdk/dotnet/Pulumi/Log.cs b/sdk/dotnet/Pulumi/Log.cs index a26991cc0..ada9802d6 100644 --- a/sdk/dotnet/Pulumi/Log.cs +++ b/sdk/dotnet/Pulumi/Log.cs @@ -31,15 +31,15 @@ namespace Pulumi => Deployment.InternalInstance.Logger.WarnAsync(message, resource, streamId, ephemeral); /// - /// Logs a fatal error to indicate that the tool should stop processing resource - /// operations immediately. + /// Logs a fatal condition. Consider raising an exception + /// after calling Error to stop the Pulumi program. /// public static void Error(string message, Resource? resource = null, int? streamId = null, bool? ephemeral = null) => Deployment.InternalInstance.Logger.ErrorAsync(message, resource, streamId, ephemeral); /// - /// Logs a fatal exception to indicate that the tool should stop processing resource - /// operations immediately. + /// Logs an exception. Consider raising the exception after + /// calling this method to stop the Pulumi program. /// public static void Exception(Exception exception, Resource? resource = null, int? streamId = null, bool? ephemeral = null) => Error(exception.ToString(), resource, streamId, ephemeral); diff --git a/sdk/go/pulumi/log.go b/sdk/go/pulumi/log.go index 482cedf1e..92c771a13 100644 --- a/sdk/go/pulumi/log.go +++ b/sdk/go/pulumi/log.go @@ -69,7 +69,8 @@ func (log *logState) Warn(msg string, args *LogArgs) error { return _log(log.ctx, log.engine, pulumirpc.LogSeverity_WARNING, msg, args) } -// Logs a fatal error to indicate that the tool should stop processing resource +// Logs a fatal condition. Consider returning a non-nil error object +// after calling Error to stop the Pulumi program. func (log *logState) Error(msg string, args *LogArgs) error { return _log(log.ctx, log.engine, pulumirpc.LogSeverity_ERROR, msg, args) } diff --git a/sdk/nodejs/log/index.ts b/sdk/nodejs/log/index.ts index 921f3bf30..91a640658 100644 --- a/sdk/nodejs/log/index.ts +++ b/sdk/nodejs/log/index.ts @@ -70,7 +70,7 @@ export function warn(msg: string, resource?: resourceTypes.Resource, streamId?: } /** - * error logs a fatal error to indicate that the tool should stop processing resource operations immediately. + * error logs a fatal condition. Consider raising an exception after calling error to stop the Pulumi program. */ export function error(msg: string, resource?: resourceTypes.Resource, streamId?: number, ephemeral?: boolean) { errcnt++; // remember the error so we can suppress leaks. diff --git a/sdk/python/lib/pulumi/log.py b/sdk/python/lib/pulumi/log.py index 8dd13f7bc..6833d528b 100644 --- a/sdk/python/lib/pulumi/log.py +++ b/sdk/python/lib/pulumi/log.py @@ -74,12 +74,15 @@ def warn(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[in def error(msg: str, resource: Optional['Resource'] = None, stream_id: Optional[int] = None, ephemeral: Optional[bool] = None): """ - Logs a message to the Pulumi CLI's error channel, associating it with a resource - and stream_id if provided. + Logs a message to the Pulumi CLI's error channel, associating it + with a resource and stream_id if provided. + + Consider raising an exception after calling error to stop the Pulumi program. :param str msg: The message to send to the Pulumi CLI. :param Optional[Resource] resource: If provided, associate this message with the given resource in the Pulumi CLI. :param Optional[int] stream_id: If provided, associate this message with a stream of other messages. + """ engine = get_engine() if engine is not None: