X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Network.Bluetooth%2FTizen.Network.Bluetooth%2FBluetoothError.cs;h=3f245d98132360c0d9a0f4ff51d83d72259ecf2b;hb=01454c7212b70aeee10187b30d141c865285c0c0;hp=83ce73d7063c4491dff3519fdfdf0a2d832296b2;hpb=7c36761ddd83423b31ee0558afb44e178fd4a2b8;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs index 83ce73d..3f245d9 100644 --- a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs @@ -27,82 +27,90 @@ namespace Tizen.Network.Bluetooth /// Exceptions for Bluetooth Errors. /// /// Thrown when the Bluetooth Error happens. - static internal void ThrowBluetoothException(int exception) + internal static void ThrowBluetoothException(int exception) + { + throw CreateBluetoothException(exception); + } + + /// + /// Creates Bluetooth Exception. + /// + internal static Exception CreateBluetoothException(int exception) { BluetoothError error = (BluetoothError)exception; switch (error) { - case BluetoothError.InvalidParameter: - throw new InvalidOperationException("Invalid parameter"); + case BluetoothError.InvalidParameter: + return new InvalidOperationException("Invalid parameter"); - case BluetoothError.Cancelled: - throw new InvalidOperationException("Operation cancelled"); + case BluetoothError.Cancelled: + return new InvalidOperationException("Operation cancelled"); - case BluetoothError.AlreadyDone: - throw new InvalidOperationException("Operation already done"); + case BluetoothError.AlreadyDone: + return new InvalidOperationException("Operation already done"); - case BluetoothError.TimedOut: - throw new InvalidOperationException("Timeout error"); + case BluetoothError.TimedOut: + return new InvalidOperationException("Timeout error"); - case BluetoothError.AuthFailed: - throw new InvalidOperationException("Authentication failed"); + case BluetoothError.AuthFailed: + return new InvalidOperationException("Authentication failed"); - case BluetoothError.AuthRejected: - throw new InvalidOperationException("Authentication rejected"); + case BluetoothError.AuthRejected: + return new InvalidOperationException("Authentication rejected"); - case BluetoothError.NoData: - throw new InvalidOperationException("No data available"); + case BluetoothError.NoData: + return new InvalidOperationException("No data available"); - case BluetoothError.NotEnabled: - throw new InvalidOperationException("Local adapter not enabled"); + case BluetoothError.NotEnabled: + return new InvalidOperationException("Local adapter not enabled"); - case BluetoothError.NotInitialized: - throw new InvalidOperationException("Local adapter not initialized"); + case BluetoothError.NotInitialized: + return new InvalidOperationException("Local adapter not initialized"); - case BluetoothError.NowInProgress: - throw new InvalidOperationException("Operation now in progress"); + case BluetoothError.NowInProgress: + return new InvalidOperationException("Operation now in progress"); - case BluetoothError.NotInProgress: - throw new InvalidOperationException("Operation not in progress"); + case BluetoothError.NotInProgress: + return new InvalidOperationException("Operation not in progress"); - case BluetoothError.NotSupported: - throw new NotSupportedException("Bluetooth is not supported"); + case BluetoothError.NotSupported: + return new NotSupportedException("Bluetooth is not supported"); - case BluetoothError.OperationFailed: - throw new InvalidOperationException("Operation failed"); + case BluetoothError.OperationFailed: + return new InvalidOperationException("Operation failed"); - case BluetoothError.OutOfMemory: - throw new InvalidOperationException("Out of memory"); + case BluetoothError.OutOfMemory: + return new InvalidOperationException("Out of memory"); - case BluetoothError.PermissionDenied: - throw new InvalidOperationException("Permission denied"); + case BluetoothError.PermissionDenied: + return new InvalidOperationException("Permission denied"); - case BluetoothError.QuotaExceeded: - throw new InvalidOperationException("Quota exceeded"); + case BluetoothError.QuotaExceeded: + return new InvalidOperationException("Quota exceeded"); - case BluetoothError.RemoteDeviceNotBonded: - throw new InvalidOperationException("Remote device not bonded"); + case BluetoothError.RemoteDeviceNotBonded: + return new InvalidOperationException("Remote device not bonded"); - case BluetoothError.RemoteDeviceNotConnected: - throw new InvalidOperationException("Remote device not connected"); + case BluetoothError.RemoteDeviceNotConnected: + return new InvalidOperationException("Remote device not connected"); - case BluetoothError.RemoteDeviceNotFound: - throw new InvalidOperationException("Remote device not found"); + case BluetoothError.RemoteDeviceNotFound: + return new InvalidOperationException("Remote device not found"); - case BluetoothError.ResourceBusy: - throw new InvalidOperationException("Device or resource busy"); + case BluetoothError.ResourceBusy: + return new InvalidOperationException("Device or resource busy"); - case BluetoothError.ResourceUnavailable: - throw new InvalidOperationException("Resource temporarily unavailable"); + case BluetoothError.ResourceUnavailable: + return new InvalidOperationException("Resource temporarily unavailable"); - case BluetoothError.ServiceNotFound: - throw new InvalidOperationException("Service Not Found"); + case BluetoothError.ServiceNotFound: + return new InvalidOperationException("Service Not Found"); - case BluetoothError.ServiceSearchFailed: - throw new InvalidOperationException("Service search failed"); + case BluetoothError.ServiceSearchFailed: + return new InvalidOperationException("Service search failed"); - default: - throw new InvalidOperationException("Unknown exception"); + default: + return new InvalidOperationException("Unknown exception"); } } }