SpectrumFileOpenException.Constructor

Creates the exception for a file that could not be opened.


Remarks

Nova’s readers throw this exception themselves; code using them catches it rather than constructing one. The message reads “Failed to open ‘<fileName>’: <detail>”.


Syntax

SyntaxDescription
SpectrumFileOpenException(string fileName, string detail)Creates the exception for a file that could not be opened.
SpectrumFileOpenException(string fileName, string detail, Exception innerException)Creates the exception for a file that could not be opened, wrapping the exception that caused it.

Parameters

NameTypeDescription
fileNamestringThe file that could not be opened.
detailstringWhy, as reported by the reader.
innerExceptionExceptionThe exception that caused the failure.

Example

1
2
3
4
5
6
7
8
9
10
11
using Nova.Io.Read;

try
{
  FileReader reader = new FileReader();
  reader.ReadSpectrum("Damaged.mzML");
}
catch (SpectrumFileOpenException ex)
{
  Console.WriteLine(ex.FileName + ": " + ex.Message);
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags