// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//============================================================
//
// Class: FileLoadException
//
// Purpose: Exception for failure to load a file that was successfully found.
//
//===========================================================
using System;
using System.Runtime.CompilerServices;
namespace System.IO
{
//|
public class FileLoadException : IOException {
private String _fileName; // the name of the file we could not load.
//|
public FileLoadException()
: base("IO.FileLoad") {
}
//|
public FileLoadException(String message)
: base(message) {
}
//|
public FileLoadException(String message, Exception inner)
: base(message, inner) {
}
//|
public FileLoadException(String message, String fileName) : base(message)
{
_fileName = fileName;
}
//|
public FileLoadException(String message, String fileName, Exception inner)
: base(message, inner) {
_fileName = fileName;
}
//|
public override String Message
{
get {
String message = base.Message;
if (message == null) {
if (_fileName == null)
return "IO.FileLoad";
else
return "IO.FileLoad" + _fileName;
}
else {
return message;
}
}
}
//|
public String FileName {
get { return _fileName; }
}
//|
public override String ToString()
{
String s = GetType().FullName + ": " + Message;
if (_fileName != null && _fileName.Length != 0)
s += Environment.NewLine + String.Format("IO.FileName_Name", _fileName);
if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
return s;
}
}
}