Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.cundong.recyclerview;

/**
* Created by teknopc on 18-May-16.
*/
public class CustomException extends RuntimeException {
public CustomException (String message){

super(message);

}

//Constructor that accepts an error message and a Throwable
public CustomException(String message, Throwable cause){

super (message, cause);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
layoutManagerType = LayoutManagerType.StaggeredGridLayout;
} else {
throw new RuntimeException(
throw new CustomException(
"Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void setAdapter(RecyclerView.Adapter<RecyclerView.ViewHolder> adapter) {

if (adapter != null) {
if (!(adapter instanceof RecyclerView.Adapter))
throw new RuntimeException("your adapter must be a RecyclerView.Adapter");
throw new CustomException("your adapter must be a RecyclerView.Adapter");
}

if (mInnerAdapter != null) {
Expand All @@ -94,7 +94,7 @@ public RecyclerView.Adapter getInnerAdapter() {
public void addHeaderView(View header) {

if (header == null) {
throw new RuntimeException("header is null");
throw new CustomException("header is null");
}

mHeaderViews.add(header);
Expand All @@ -104,7 +104,7 @@ public void addHeaderView(View header) {
public void addFooterView(View footer) {

if (footer == null) {
throw new RuntimeException("footer is null");
throw new CustomException("footer is null");
}

mFooterViews.add(footer);
Expand Down