Class ErrorCode

java.lang.Object
com.frostwire.jlibtorrent.ErrorCode

public final class ErrorCode extends Object
Error status information from libtorrent operations.

ErrorCode wraps error information from libtorrent C++ library, containing an integer error code value and human-readable error message. Used throughout jlibtorrent to report operation failures in a portable way.

Understanding Error Codes:

 ErrorCode ec = ...;  // From alert or API

 // Check if this is actually an error
 if (ec.isError()) {
     // An error occurred
     int code = ec.value();
     String msg = ec.message();

     System.err.println(\"Error \" + code + \": \" + msg);
 }
 

Common Error Scenarios:

 // Network errors (Connection refused, timeout, etc)
 // I/O errors (Disk full, permission denied, etc)
 // Protocol errors (Invalid metadata, corrupted files, etc)
 // System errors (Memory allocation, resource limits, etc)
 

Error Information Properties:

  • value(): Integer error code (platform/system dependent)
  • message(): Human-readable error description
  • isError(): True only if an actual error (0 = no error)
See Also:
  • Constructor Details

    • ErrorCode

      public ErrorCode(com.frostwire.jlibtorrent.swig.error_code ec)
      Parameters:
      ec - the native object
  • Method Details

    • value

      public int value()
      Returns:
      the internal error code value
    • message

      public String message()
      Returns:
      the error message
    • isError

      public boolean isError()
      Returns if this error code actually represents an error.
      Returns:
      true if an actual error