refactored exception logic for fragments
added tests for fragments extension