Skip to content

Commit

Permalink
Add more I/O exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
io7m committed Aug 3, 2024
1 parent 3a75733 commit 7e16e24
Show file tree
Hide file tree
Showing 5 changed files with 909 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/*
* Copyright © 2024 Mark Raynsford <[email protected]> https://www.io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/


package com.io7m.seltzer.io;

import java.util.Map;
import java.util.Optional;

/**
* A convenient extension of the standard {@link java.nio.channels.ClosedChannelException} class.
*/

public class SClosedChannelException extends SIOException
{
/**
* Construct an exception.
*
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(cause, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param cause The cause
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final Throwable cause,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(cause, inErrorCode, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
*/

public SClosedChannelException(
final String message,
final Throwable cause,
final String inErrorCode)
{
super(message, cause, inErrorCode);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
*/

public SClosedChannelException(
final String message,
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes)
{
super(message, cause, inErrorCode, inAttributes);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final String message,
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(message, cause, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final String message,
final Throwable cause,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(message, cause, inErrorCode, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final String message,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(message, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SClosedChannelException(
final String message,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(message, inErrorCode, inRemediatingAction);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/*
* Copyright © 2024 Mark Raynsford <[email protected]> https://www.io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/


package com.io7m.seltzer.io;

import java.util.Map;
import java.util.Optional;

/**
* A convenient extension of the standard {@link java.io.EOFException} class.
*/

public class SEOFException extends SIOException
{
/**
* Construct an exception.
*
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(cause, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param cause The cause
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final Throwable cause,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(cause, inErrorCode, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
*/

public SEOFException(
final String message,
final Throwable cause,
final String inErrorCode)
{
super(message, cause, inErrorCode);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
*/

public SEOFException(
final String message,
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes)
{
super(message, cause, inErrorCode, inAttributes);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final String message,
final Throwable cause,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(message, cause, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param cause The cause
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final String message,
final Throwable cause,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(message, cause, inErrorCode, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param inErrorCode The error code
* @param inAttributes The attributes
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final String message,
final String inErrorCode,
final Map<String, String> inAttributes,
final Optional<String> inRemediatingAction)
{
super(message, inErrorCode, inAttributes, inRemediatingAction);
}

/**
* Construct an exception.
*
* @param message The message
* @param inErrorCode The error code
* @param inRemediatingAction The remediating action
*/

public SEOFException(
final String message,
final String inErrorCode,
final Optional<String> inRemediatingAction)
{
super(message, inErrorCode, inRemediatingAction);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* A convenient extension of the standard {@link IOException} class.
*/

public final class SIOException
public class SIOException
extends IOException
implements SStructuredErrorExceptionType<String>
{
Expand Down Expand Up @@ -207,25 +207,25 @@ public SIOException(
}

@Override
public String errorCode()
public final String errorCode()
{
return this.errorCode;
}

@Override
public Map<String, String> attributes()
public final Map<String, String> attributes()
{
return this.attributes;
}

@Override
public Optional<String> remediatingAction()
public final Optional<String> remediatingAction()
{
return this.remediatingAction;
}

@Override
public Optional<Throwable> exception()
public final Optional<Throwable> exception()
{
return Optional.of(this);
}
Expand Down
Loading

0 comments on commit 7e16e24

Please sign in to comment.