class_docstr: Converts protobuf errors to exceptions and vice versa.
class_docstr_tok: ["Converts","protobuf","errors","to","exceptions","and","vice","versa","."]
docstr: Convert a protobuf error to an exception.
  
  Args:
      error: The protobuf error to convert.
  
  Returns:
      The corresponding exception.
docstr_tok: ["Convert","a","protobuf","error","to","an","exception",".","Args",":","error",":","The","protobuf","error","to","convert",".","Returns",":","The","corresponding","exception","."]
code: def to_exception(error: pb.ErrorInfo) -> Optional[Error]:
      """Convert a protobuf error to an exception.
  
      Args:
          error: The protobuf error to convert.
  
      Returns:
          The corresponding exception.
  
      """
      if not error.SerializeToString():
          return None
  
      if error.code in to_exception_map:
          return to_exception_map[error.code](error.message)
      return Error(error.message)
  
imports: from typing import Optional
  from wandb.proto import wandb_internal_pb2
  from .None import AuthenticationError, CommError, Error, UnsupportedError, UsageError
label_desc: Use image node_id 1 for calling the ProtobufErrorHandler obj's underlying member method code with example usage: obj.to_exception(error) and returns: Error, None, to_exception_map