[base] TokenShaper: added error codes and adapted unit test.