You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							50 lines
						
					
					
						
							1.7 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							50 lines
						
					
					
						
							1.7 KiB
						
					
					
				
								/**
							 | 
						|
								 * DailyNotificationError.swift
							 | 
						|
								 * Daily Notification Plugin for Capacitor
							 | 
						|
								 *
							 | 
						|
								 * Defines error types and handling for the notification plugin
							 | 
						|
								 */
							 | 
						|
								
							 | 
						|
								import Foundation
							 | 
						|
								
							 | 
						|
								/// Represents possible errors that can occur within the DailyNotification plugin
							 | 
						|
								///
							 | 
						|
								/// These errors provide specific failure cases and associated messages for better
							 | 
						|
								/// error handling and debugging in the notification scheduling process.
							 | 
						|
								public enum DailyNotificationError: Error {
							 | 
						|
								    /// Thrown when required parameters are missing or invalid
							 | 
						|
								    case invalidParameters(String)
							 | 
						|
								    
							 | 
						|
								    /// Thrown when notification permissions have not been granted
							 | 
						|
								    case permissionDenied
							 | 
						|
								    
							 | 
						|
								    /// Thrown when notification scheduling fails
							 | 
						|
								    case schedulingFailed(String)
							 | 
						|
								    
							 | 
						|
								    /// Thrown when time format is invalid (should be HH:mm)
							 | 
						|
								    case invalidTimeFormat
							 | 
						|
								    
							 | 
						|
								    /// Thrown when provided timezone identifier is invalid
							 | 
						|
								    case invalidTimezone
							 | 
						|
								    
							 | 
						|
								    /// Thrown when priority value is not one of: high, default, low
							 | 
						|
								    case invalidPriority
							 | 
						|
								    
							 | 
						|
								    /// Human-readable error messages for each error case
							 | 
						|
								    public var message: String {
							 | 
						|
								        switch self {
							 | 
						|
								        case .invalidParameters(let detail):
							 | 
						|
								            return "Invalid parameters: \(detail)"
							 | 
						|
								        case .permissionDenied:
							 | 
						|
								            return "Notification permissions not granted"
							 | 
						|
								        case .schedulingFailed(let reason):
							 | 
						|
								            return "Failed to schedule notification: \(reason)"
							 | 
						|
								        case .invalidTimeFormat:
							 | 
						|
								            return "Invalid time format. Expected HH:mm"
							 | 
						|
								        case .invalidTimezone:
							 | 
						|
								            return "Invalid timezone identifier"
							 | 
						|
								        case .invalidPriority:
							 | 
						|
								            return "Invalid priority value. Expected 'high', 'default', or 'low'"
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								} 
							 |