import { useState } from 'react';

function useError() {
  const [error, setError] = useState(null);

  if (error?.message === 'No connection established') {
    throw error;
  }

  return [error, setError];
}

export default useError;
