added create repo api, also improved err handling