Fix docstring on node log.error and other SDK equivalents (#6573)

* Fix docstring of log.error across SDKs to explain non-termination

* Accept PR feedback, briefer docstrings.
This commit is contained in:
Anton Tayanovskyy 2021-03-18 13:57:10 -04:00 committed by GitHub
parent 172fdb2e0d
commit 22f332e094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 10 deletions

View file

@ -66,8 +66,8 @@ namespace Pulumi
}
/// <summary>
/// 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.
/// </summary>
Task ILogger.ErrorAsync(string message, Resource? resource, int? streamId, bool? ephemeral)
=> ErrorAsync(message, resource, streamId, ephemeral);

View file

@ -31,15 +31,15 @@ namespace Pulumi
=> Deployment.InternalInstance.Logger.WarnAsync(message, resource, streamId, ephemeral);
/// <summary>
/// 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.
/// </summary>
public static void Error(string message, Resource? resource = null, int? streamId = null, bool? ephemeral = null)
=> Deployment.InternalInstance.Logger.ErrorAsync(message, resource, streamId, ephemeral);
/// <summary>
/// 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.
/// </summary>
public static void Exception(Exception exception, Resource? resource = null, int? streamId = null, bool? ephemeral = null)
=> Error(exception.ToString(), resource, streamId, ephemeral);

View file

@ -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)
}

View file

@ -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.

View file

@ -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: