15 lines
		
	
	
		
			319 B
		
	
	
	
		
			PHP
		
	
		
		
			
		
	
	
			15 lines
		
	
	
		
			319 B
		
	
	
	
		
			PHP
		
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function getError($message, $error = '', $environment = null) {
							 | 
						||
| 
								 | 
							
								    global $config;
							 | 
						||
| 
								 | 
							
								    $environment = $config['environment'] ?? 'production';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    if ($environment === 'production') {
							 | 
						||
| 
								 | 
							
								        return 'There was an unexpected error. Please try again.';
							 | 
						||
| 
								 | 
							
								    } else {
							 | 
						||
| 
								 | 
							
								        return $error ?: $message;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								?>
							 |