Given

For continuity at x=0,
x→0−limf(x)=f(0)=x→0+limf(x)=2
Left-hand limit
x→0−limxsin(a+1)x+2sinx=(a+1)+2=a+3
Since the limit must equal 2,
a+3=2
a=−1
Right-hand limit
x→0+limx1+bx−1=x→0+lim1+bx+1b=2b
Since the limit must equal 2,
2b=2
b=4
Answer
a=−1,b=4