Show a proper error. A failure doesn't always mean the command isn't available, and we check for it on startup
This commit is contained in:
		
							parent
							
								
									8829a408ec
								
							
						
					
					
						commit
						369581db6d
					
				
					 3 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -21,8 +21,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
 | 
			
		|||
        {error, 1} -> {:error, error}
 | 
			
		||||
      end
 | 
			
		||||
    rescue
 | 
			
		||||
      _e in ErlangError ->
 | 
			
		||||
        {:error, "exiftool command not found"}
 | 
			
		||||
      e in ErlangError ->
 | 
			
		||||
        {:error, "#{__MODULE__}: #{inspect(e)}"}
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,8 +44,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
 | 
			
		|||
      Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
 | 
			
		||||
      {:ok, :filtered}
 | 
			
		||||
    rescue
 | 
			
		||||
      _e in ErlangError ->
 | 
			
		||||
        {:error, "mogrify command not found"}
 | 
			
		||||
      e in ErlangError ->
 | 
			
		||||
        {:error, "#{__MODULE__}: #{inspect(e)}"}
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,8 +14,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
 | 
			
		|||
      do_filter(file, Pleroma.Config.get!([__MODULE__, :args]))
 | 
			
		||||
      {:ok, :filtered}
 | 
			
		||||
    rescue
 | 
			
		||||
      _e in ErlangError ->
 | 
			
		||||
        {:error, "mogrify command not found"}
 | 
			
		||||
      e in ErlangError ->
 | 
			
		||||
        {:error, "#{__MODULE__}: #{inspect(e)}"}
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue