Description Usage Arguments Value Functions See Also Examples
IOException
s and their sub-classes are Exception
s that describe
problems encoutered reading or writting to a file, network socket, console,
connection, etc. Subclasses extended the specificity of the
IOException
and can include data elements. See
Exception
. These exceptions are intended to be signaled, i.e.
with stop
and exist both to provide pre-defined error messages and so
that handlers in try/catch blocks have latitude to choose what granularity of
exception to catch.
message |
The message associated with the exception, for reading by
humans. The default message is usually good enough, but can be overriden
through this parameter if needed. When constructed inside packages, the
message displayed will have the name of the package prepended as
|
call |
The call or call stack associated with the exception. By default
this is NULL as |
package |
The package where this exception is generated. May be
|
... |
Additional arguments defining |
path |
The path associated with an exception, as a one element character
vector This is required for a |
target |
The target associated with a problematic file system link. This
is required for a |
An IOException
or descendant describing some problematic
event involving a file system, a network socket, etc. Always has or extends
class c( "IOException", "Exception", "condition" )
.
IOException
: This exception and sub-classes are Exception
s that describe
problems encoutered reading or writting to a file, network socket, console,
connection, etc.
message: "[package] An IOException occurred.
class: c( "IOException", "Exception", "condition" )
data: None
FileSystemException
: This exception and sub-classes are Exception
s that describe
problems encoutered reading or writting to a file system, disk, etc.
message: "[package] A FileSystemException occurred.
"
class: c( "FileSystemException", "IOException", "Exception",
"condition" )
data: None
PathException
: This exception and sub-classes are FileSystemException
s that describe
problems encoutered in the context of an operation on a file system path.
Always includes a "path" data element, accessible with
exceptionPath
.
message: '[package] A PathException occurred involving
path: "path". (Running in: "getwd()").
'
class: c( "PathException", "FileSystemException",
"IOException", "Exception", "condition" )
data: path
- see exceptionPath
.
FileException
: This exception and sub-classes are PathException
s that describe
problems reading, writing, creating, or deleting a file (not a directory).
Always includes a "path" data element, accessible with
exceptionPath
. Issues with the contents of a file are
not IOExceptions
, those are likely DataFormatException
s or
DataValueException
s. The path may be a valid link to a file, or a
nested series of links, but this should be transparent. The code generating
the exception should identify LinkExceptions
separately.
message: '[package] A FileException occurred involving
file: "path". (Running in: "getwd()").'
class: c( "FileException", "PathException",
"FileSystemException", "IOException", "Exception", "condition" )
data: path
- see exceptionPath
.
DirectoryException
: This exception and sub-classes are PathException
s that describe
problems reading, writing, creating, or deleting a directory. Always includes
a "path" data element, accessible with exceptionPath
. The
path may be a valid link to a directory, or a nested series of links, but
this should be transparent. The code generating the exception should identify
LinkExceptions
separately.
message: '[package] A DirectoryException occurred
involving directory: "path". (Running in: "getwd()").'
class: c( "DirectoryException", "PathException",
"FileSystemException", "IOException", "Exception", "condition" )
data: path
- see exceptionPath
.
LinkException
: This exception and sub-classes are PathException
s that describe
problems creating, deleating, or using a hard or soft/symbolic link to a file
system object. Always includes a "path" data element, accessible with
exceptionPath
and a "target" data element, accessible with
exceptionTarget
. Problems with the target (so long as it
exists) are not a problem with the link but a problem with the target only.
The fact that the path is a link should be ignored in this case and the
exception should be based on the target object (file, directory, or
possibly a link.)
message: '[package] A LinkException occurred involving
link: "path" with target: "target". (Running in:
"getwd()").'
class: c( "LinkException", "PathException",
"FileSystemException", "IOException", "Exception", "condition" )
data: path
- see exceptionPath
.
data: target
- see exceptionTarget
.
NoSuchLinkTargetException
: If a link's target is invalid
message: '[package] The link target does not exist;
link: "path" with target: "target". (Running in:
"getwd()").'
class: c( "NoSuchLinkTargetException", "LinkException", "PathException",
"FileSystemException", "IOException", "Exception", "condition" )
data: path
- see exceptionPath
.
data: target
- see exceptionTarget
.
NoSuchFileException
: The specified file was not found on the file system.
message: '[package] No such file: "path".
(Running in: "getwd()").'
class: c( "NoSuchFileException", "FileException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
NoSuchDirectoryException
: The specified directory was not be found on the file system.
message: '[package] No such directory: "path".
(Running in: "getwd()").'
class: c( "NoSuchDirectoryException", "DirectoryException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
NoSuchLinkException
: The specified link was not be found on the file system. Should only be used
when the path is expected by the user to be a link. Usually a link is used
transparently to identify a file or directory, in which case a
NoSuchFileException
or NoSuchDirectoryException
should be used.
message: '[package] No such link: "path".
(Running in: "getwd()").'
class: c( "NoSuchLinkException", "LinkException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
data: target
- see exceptionTarget
.
FileExistsException
: The specified file already exists on the file system.
message: '[package] File already exists: "path".
(Running in: "getwd()").'
class: c( "FileExistsException", "FileException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
DirectoryExistsException
: The specified directory already existins on the file system.
message: '[package] Directory already exists: "path".
(Running in: "getwd()").'
class: c( "DirectoryExistsException", "DirectoryException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
LinkExistsException
: The specified link already exists on the file system. Should only be used
when the path is expected by the user to be a link. Usually a link is used
transparently to identify a file or directory, in which case a
FileExistsException
or DirectoryExistsException
should be used.
message: '[package] Link already exists: "path".
(Running in: "getwd()").'
class: c( "LinkExistsException", "LinkException",
"PathException", "FileSystemException", "IOException", "Exception",
"condition" )
data: path
- see exceptionPath
.
data: target
- see exceptionTarget
.
condition
, conditionMessage()
, conditionCall
,
Exception
, exceptionPackage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ioEx <- IOException()
conditionMessage(ioEx)
conditionCall(ioEx)
exceptionPackage(ioEx)
ioEx <- IOException( "Including the call stack", call=sys.calls() )
ioEx <- IOException( "Lying about the package", package="NotMine" )
ioEx <- IOException( "Extra data included", x=1, y=list(A=1, B="two"), path="../" )
x <- ioEx$x
y <- ioEx$y
path <- exceptionPath(ioEx)
path == ioEx$path
pEx <- PathException( "/some/path" )
thePath <- exceptionPath(pEx)
## Not run:
wantToCreate <- "theFile"
if ( file.exists( wantToCreate )) {
if (is.dir) { stop( DirectoryExists( wantToCreate )) }
else { stop( FileExists( wantToCreate )) }
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.