/* * Copyright 2013 Klaus Reimer * See LICENSE.md for licensing information. * * Based on libusb : * * Copyright 2001 Johannes Erdfelt * Copyright 2007-2009 Daniel Drake * Copyright 2010-2012 Peter Stuge * Copyright 2008-2011 Nathan Hjelm * Copyright 2009-2012 Pete Batard * Copyright 2009-2012 Ludovic Rousseau * Copyright 2010-2012 Michael Plante * Copyright 2011-2012 Hans de Goede * Copyright 2012 Martin Pieuchot * Copyright 2012-2013 Toby Gray */ package org.usb4java.libusb; import javax.usb.UsbException; /** * libusb-specific USB exception. * * @author Klaus Reimer (k@ailis.de) */ public final class LibUsbException extends UsbException { /** Serial version UID. */ private static final long serialVersionUID = 1L; /** The error code. */ private final int errorCode; /** * Constructor. * * @param message * The error message. * @param errorCode * The error code. */ public LibUsbException(final String message, final int errorCode) { super(String.format("USB error %d: %s: %s", -errorCode, message, LibUsb.strError(errorCode))); this.errorCode = errorCode; } /** * Returns the error code. * * @return The error code */ public int getErrorCode() { return this.errorCode; } }