Class UnsupportedSourceLanguageException

All Implemented Interfaces:
CopilotErrorCode, Serializable
Direct Known Subclasses:
KotlinNotSupportedException

public class UnsupportedSourceLanguageException extends CopilotException implements CopilotErrorCode
Thrown when Copilot understands the request but cannot carry it out for this source language yet.

This is a refusal, not a bug: the operation is simply not implemented for the language, so the frontend should say so plainly rather than reporting a failure. The operation is the wire command name where there is one, so the message can name what was declined.

See Also:
  • Field Details

  • Constructor Details

    • UnsupportedSourceLanguageException

      public UnsupportedSourceLanguageException(SourceLanguage language, String operation)
      Parameters:
      language - the language that is not supported for this operation
      operation - the operation that was declined, typically the wire command name
    • UnsupportedSourceLanguageException

      protected UnsupportedSourceLanguageException(String message, SourceLanguage language, String operation)
      Allows a subclass to keep a pre-existing message while still carrying the error code.
      Parameters:
      message - the message to report
      language - the language that is not supported, may be null
      operation - the operation that was declined, may be null
  • Method Details

    • getLanguage

      public SourceLanguage getLanguage()
      Returns:
      the unsupported language, may be null when not known
    • getOperation

      public String getOperation()
      Returns:
      the declined operation, may be null when not known
    • getErrorCode

      public String getErrorCode()
      Description copied from interface: CopilotErrorCode
      A stable, kebab-case identifier for this kind of failure. Sent to the frontend as error.code.
      Specified by:
      getErrorCode in interface CopilotErrorCode
      Returns:
      the error code
    • getErrorDetails

      public Map<String,String> getErrorDetails()
      Description copied from interface: CopilotErrorCode
      Extra machine-readable context, merged into the error object sent to the frontend. Keys must not collide with the error object's own fields (message, code, and the exception keys).
      Specified by:
      getErrorDetails in interface CopilotErrorCode
      Returns:
      the details, empty by default