|
| 1 | +// <copyright file="NoSuchDriverException.cs" company="WebDriver Committers"> |
| 2 | +// Licensed to the Software Freedom Conservancy (SFC) under one |
| 3 | +// or more contributor license agreements. See the NOTICE file |
| 4 | +// distributed with this work for additional information |
| 5 | +// regarding copyright ownership. The SFC licenses this file |
| 6 | +// to you under the Apache License, Version 2.0 (the "License"); |
| 7 | +// you may not use this file except in compliance with the License. |
| 8 | +// You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, software |
| 13 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +// See the License for the specific language governing permissions and |
| 16 | +// limitations under the License. |
| 17 | +// </copyright> |
| 18 | + |
| 19 | +using System; |
| 20 | +using System.Runtime.Serialization; |
| 21 | + |
| 22 | +namespace OpenQA.Selenium |
| 23 | +{ |
| 24 | + /// <summary> |
| 25 | + /// The exception that is thrown when a driver is not found. |
| 26 | + /// </summary> |
| 27 | + [Serializable] |
| 28 | + public class NoSuchDriverException : NotFoundException |
| 29 | + { |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Link to the documentation for this error |
| 33 | + /// </summary> |
| 34 | + private static string supportUrl = baseSupportUrl + "/driver_location"; |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Initializes a new instance of the <see cref="NoSuchDriverException"/> class. |
| 38 | + /// </summary> |
| 39 | + public NoSuchDriverException() |
| 40 | + : base(GetMessage("")) |
| 41 | + { |
| 42 | + } |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Initializes a new instance of the <see cref="NoSuchDriverException"/> class with |
| 46 | + /// a specified error message. |
| 47 | + /// </summary> |
| 48 | + /// <param name="message">The message that describes the error.</param> |
| 49 | + public NoSuchDriverException(string message) |
| 50 | + : base(GetMessage(message)) |
| 51 | + { |
| 52 | + } |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// Initializes a new instance of the <see cref="NoSuchDriverException"/> class with |
| 56 | + /// a specified error message and a reference to the inner exception that is the |
| 57 | + /// cause of this exception. |
| 58 | + /// </summary> |
| 59 | + /// <param name="message">The error message that explains the reason for the exception.</param> |
| 60 | + /// <param name="innerException">The exception that is the cause of the current exception, |
| 61 | + /// or <see langword="null"/> if no inner exception is specified.</param> |
| 62 | + public NoSuchDriverException(string message, Exception innerException) |
| 63 | + : base(GetMessage(message), innerException) |
| 64 | + { |
| 65 | + } |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Initializes a new instance of the <see cref="NoSuchDriverException"/> class with serialized data. |
| 69 | + /// </summary> |
| 70 | + /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized |
| 71 | + /// object data about the exception being thrown.</param> |
| 72 | + /// <param name="context">The <see cref="StreamingContext"/> that contains contextual |
| 73 | + /// information about the source or destination.</param> |
| 74 | + protected NoSuchDriverException(SerializationInfo info, StreamingContext context) |
| 75 | + : base(info, context) |
| 76 | + { |
| 77 | + } |
| 78 | + |
| 79 | + /// <summary> |
| 80 | + /// Add information about obtaining additional support from documentation to this exception. |
| 81 | + /// </summary> |
| 82 | + /// <param name="message">The original message for exception</param> |
| 83 | + /// <returns>The final message for exception</returns> |
| 84 | + protected static string GetMessage(string message) |
| 85 | + { |
| 86 | + return message + "; " + supportMsg + supportUrl; |
| 87 | + } |
| 88 | + } |
| 89 | +} |
0 commit comments